[Haskell-cafe] New type of ($) operator in GHC 8.0 is problematic

Mike Izbicki mike at izbicki.me
Fri Feb 5 23:21:00 UTC 2016


> We're in a bit of a bind in all this. We really need the fancy type for ($)
> so that it can be used in all situations where it is used currently. The old
> type for ($) was just a plain old lie. Now, at least, we're not lying. So,
> do we 1) lie, 2) allow the language to grow, or 3) avoid certain growth
> because it affects how easy the language is to learn? I don't really think
> anyone is advocating for (3) exactly, but it's hard to have (2) and not make
> things more complicated -- unless we have a beginners' mode or other
> features in, say, GHCi that aid learning. As I've said, I'm in full favor of
> adding these features.

The old type for ($) is only a lie when the MagicHash extension is
turned on.  Otherwise, it is not a lie.  I think the best solution is
to pretty print the type depending on what language pragmas are in
use.  In GHCI, this would be trivial.  The much harder case is haddock
documentation.

I think a good way around this would be an eventual patch to haddock
that allows the user to select which extensions they want to use when
browsing documentation.  There's a lot of usability issues that would
need to be resolved with this still, but it reduces this technical
discussion we're having down to a design discussion.  It also nicely
lets the user specify the level of difficulty they want their prelude
to be without causing incompatibilty with users who want a different
level of prelude.


More information about the ghc-devs mailing list