Haskell Community [Unofficial]
@discourse.haskell.org.web.brid.gy
6057 documents discourse.haskell.org
View on Bluesky
[ANN] tricorder - a new development tool for Haskell and LLMs

Hey everyone,

for those of you who don’t know me, my name is Christian and I’m an engineer at Tweag.

I am very pleased to announce the very first release of tricorder!

tricorder has been my daily driver for Haskell development for months now. It works really well as a standalone replacement for ghcid or ghciwatch with some features that make it very attractive:

  • Multiple component…
Read more →
Serokell’s Work on GHC: Dependent Types, Part 5

I’m surprised/disappointed. This gets rejected:

t42 = Typed (type Int) 42

    Unexpected keyword `type’
    Suggested fix: … `ExplicitNamespaces’ … (implied by …)

If there’s anything that implies that extension, surely it would be RequiredTypeArguments(?) I particularly remember that stipulation in the discussion.

Serokell’s Work on GHC: Dependent Types, Part 5
  • The flip situation is indeed rather disappointing. For reference, Agda’s type for flip looks like this:

    flip : ∀ {A : Set a} {B : Set b} {C : A → B → Set c} →
           ((x : A) (y : B) → C x y) → ((y : B) (x : A) → C x y)
    flip f = λ y x → f x y
    

And it relies on higher-order unification to instantiate C at use sites. It’s not clear to me what the Haskell solution…

Read more →
Euterpea library to create music with Haskell

in ghci :
- I played the file (i.e. saved in music.hs) using my piano (BlueTooth MIDI #7),

  • saved to a midi file called music.midi and

  • opened the file using MuseScore

    Loaded package environment from /Users/me/.ghc/aarch64-darwin-9.6.6/environments/default
    GHCi, version 9.6.6:
    :? for help
    ghci> :l music.hs
    [1 of 2] Compiling Main ( music.hs,…

Read more →
Monad of No Return: The Great Patchening

Hi all!

_tl;dr: I have 148 packages on stackage to patch for compatibility, and I’d like your help!_

I’ve got another update on the Monad of No Return/Monoid of No Mappend proposal.

Following proposal acceptance just under a year ago, I started implementation this year. Recently the MR is in a good enough state for me to check it against clc-stackage, a tool for building all of stackage…

Read more →
H2JVM - A Haskell Library for writing JVM Bytecode

Thanks for the info. I was mostly wondering about a case such as marking something as both public and private—ideally that wouldn’t be possible, but maybe it’s last-one-wins?

Alternatively, if it were an argument to runClassBuilder then it would be syntactically impossible to supply multiple, but then it would also be a required parameter (no defaulting).

Not necessarily a big problem, it’s…

Read more →
H2JVM - A Haskell Library for writing JVM Bytecode

@evincar wondering your thoughts (and anyone else’s of course!) on making the MonadFix approach the only way to emit labels. I think this would make the UnmarkedLabel error mostly impossible (apart from weird cases like sharing labels across CodeBuilders, which could be prevented with a state variable like ST does). However it also forces a certain style upon users, which might be a bit…

H2JVM - A Haskell Library for writing JVM Bytecode

Thank you for the feedback!

All addAccessFlag does is prepends it to a list in the underlying state monad, so nothing super interesting. You’re able to use it with multiple different flags in the way you’d expect. I’ll consider adding an overload to add multiple at once.

There’s no check for duplicates, but since the flags compile down to a simple bitmask, nothing weird would happen if you…

H2JVM - A Haskell Library for writing JVM Bytecode

Wow, this is all amazing, thank you so much for such thorough feedback!

The MonadFix suggestion is fantastic, I’m not too familiar with that part of the language but this does seem like a perfect usage!

I’ll try and find a more elegant way of expressing the reversed list, as I see there’s no single consensus about the best option. At the moment I’m probably leaning towards a simple newtype…

Read more →
Serokell’s Work on GHC: Dependent Types, Part 5

-- Expressions
t1 = Typed Int 42
t2 = Typed String “hello”
t3 = Typed (Int → Bool) even

I’m so used to putting the type following the expr, this still doesn’t feel right (even though I knew it was coming). Is it really not possible to support

t1’ = Typed 42 (type Int)

  Typed :: forall a. a → (type a) → T a
Looking for a parsec maintainer to assist with GHC 9.14 compatibility (is this package still actively maintained?)

jonathanknowles:

Even though the parsec-3.1.18.0 boot package bundled with GHC 9.14.1 was itself compiled against base-4.22.0.0, the version on Hackage (with an outdated upper bound on base) seems to cause dependency resolution failures for packages that transitively depend on parsec-3.1.18.0 when building with GHC 9.14.1.

This looks like an error in the GHC release…

Read more →
Serokell’s Work on GHC: Dependent Types, Part 5

Thank you Vladislav.

Good to hear you could rescue the StarIsType syntax. TIL (*) → (*) is also a valid kind. That looks even more like an operator section.

Might kind signatures turn up in patterns in future work? Is there a risk of confusing the kind -> with a ViewPattern?

Mutation Testing in Haskell

There’s a GHC plugin that compiles all the mutations into the same binary so that you still only need to compile once. The mutations are then activated one-by-one at runtime by the mutation engine.

Extension or Imitation?

I wrote this little Haskell Quiz (with help from some friends); in the style of “CSS or BS”; Can you tell the valid Haskell Language Extensions (based on the GHC docs), from the Impostors?

doscienceto.it

Extension or Imitation?

Can you tell the real Haskell Language Extensions from the Imitations?

H2JVM - A Haskell Library for writing JVM Bytecode

Sure; DList can do more, but for the common case of just needing to accumulate a list in the opposite order of the desired order of the result, it seems like overkill (both in terms of intelligibility and allocation).

I feel like people get the impression that using function composition is somehow leading to some aspect having zero overhead, but it isn’t. And in particular, the final toList

Read more →
H2JVM - A Haskell Library for writing JVM Bytecode

evincar:

instead of storing a list in reverse order you can use a DList

I’m always suspicious of DList in that physically it is essentially storing a list in reverse order, just less clearly: each closure is closing over one new element (actually, over another closure capturing that element) and over the closure recursively referencing the rest of the elements, which is the same structure…

Read more →