[GHC] #7019: Wrong error message when using forall in constraints
GHC
cvs-ghc at haskell.org
Thu Jun 21 15:12:46 CEST 2012
#7019: Wrong error message when using forall in constraints
------------------------------+---------------------------------------------
Reporter: sjoerd_visscher | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
I tried this in GHC 7.4.1:
{{{
{-# LANGUAGE ConstraintKinds, RankNTypes, UndecidableInstances #-}
newtype Free c a = Free { runFree :: forall r. c r => (a -> r) -> r }
type C c = forall a. c (Free c a)
instance C c => Monad (Free c) where
return a = Free ($ a)
Free f >>= g = f g
}}}
Which gives this error:
{{{
Could not deduce (c (Free c b)) arising from a use of `f'
from the context (C c)
}}}
So apparently the forall is silently dropped.
Without UndecidableInstances the error is:
{{{
Illegal irreducible constraint forall a. c (Free c a)
in superclass/instance head context (Use -XUndecidableInstances to
permit this)
}}}
giving the impression that it is allowed.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7019>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list