[Haskell-cafe] GHC 8 + ImpredictiveTypes + $

Brendan Hay brendan.g.hay at gmail.com
Fri Jun 10 08:59:51 UTC 2016


Hi,

I have had a number of trivial compilation failures in many of my projects
that contain instances for MonadBaseControl (from monad-control) since
upgrading to GHC 8.

Now, I say 'trivial' since the actual fix is incredibly minor - a change of
compose (.) to apply ($). What was less trivial was the (additional) hair
loss arriving at the fix. I've put together a minimal example that
demonstrates both the failing (pre-GHC8) and the fixed (GHC8) instances
here:
https://gist.github.com/brendanhay/e6f2501c15ac5160ca7dbb6ada6777f0

Since I found the error message somewhat directionless, I'd like some help
actually understanding the root cause and why the 'fix' works:

* I assume previously GHC did not fully check type aliases that were
impredictive prior to GHC 8?

* What does this imply for a type alias such as for the alias RunInBase
used in monad-control that contains RankNTypes:
http://hackage.haskell.org/package/monad-control-1.0.1.0/docs/Control-Monad-Trans-Control.html#t:RunInBase
-
Is such an alias not safe in some sense? (Was it never safe?)

* How does the use of ($) vs (.) fix this particular issue? (I'd naively
assume the usage here would be equivalent.) I recall reading about ($)'s
magical type alias somewhere - is this related?


Cheers,
Brendan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160610/a118568f/attachment.html>


More information about the Haskell-Cafe mailing list