[Haskell-cafe] Ambiguous type variable ‘f0’ arising from a use of ‘f’

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sun Mar 20 20:33:52 UTC 2016


Hi Richard, thank you very much for the explanations.

On Sun, Mar 20, 2016 at 02:47:18PM -0400, Richard Eisenberg wrote:
> GHC 8 does implicit quantification a little differently than previous
> versions.  Previously, writing `=>` in a type meant that GHC looked
> through the type for free variables and put an implicit `forall` for those
> variables out front.  GHC 8 doesn't do this, explaining the first change. 

That makes sense, thanks.

> As for the second change, GHC 7.10 should not have accepted the old
> program, as it was incorrect.  The problem is that GHC must infer types
> for f' and g'.  These types are constrained (they have `Applicative f
> =>`).  They have no type signature, nor are they declared using function
> syntax.  Thus, the monomorphism restriction applies, causing chaos.  I bet
> enabling -XNoMonomorphismRestriction would allow you to undo the second
> change.

According to Travis the old program compiled on 7.8 and 7.10.  It certainly
compiled on 7.6 on my local machine.  When was the change that made it break
introduced (and what was that change exactly)?

Tom


More information about the Haskell-Cafe mailing list