1. 18
  1.  

  2. 5

    Pleasantly accessible! We need more articles like this in the ecosystem that explain scary-looking things like GHC extensions in terms of approachable and useful examples.

    1. 3

      Author here, thanks for the kind words! To be honest, I wrote it merely because I kept forgetting what forall was about, so in part it was written for the future me :D. But I did try my best to make it readable.

    2. 2

      Haskell’s cousin PureScript requires explicit forall. As a bonus, , the symbol (Vim digraph FA), is supported by the compiler.

      1. 1

        As is often the case, “There’s an extension for that”.

        1. 2

          So was the explicit forall, built-in is different from ‘needs extension’.

      2. 2

        I don’t understand the motivation for the ScopedTypeVariable example, can you just not elide the type annotation for ys altogether in this case?

        1. 1

          You could, but there’s some more advanced cases where a type signature will be required (often involving higher rank types).

          There’s also cases where having the function signature visible helps with code readability a lot.

          1. 1

            I mean it’s not that I don’t believe there are good uses for it, it’s just that this example doesn’t make any of them obvious to me.

        2. 1

          In case it’s unclear from the title: Haskell does not have forall but there is a GHC extension which adds it.