[GHC] #7019: Wrong error message when using forall in constraints
GHC
cvs-ghc at haskell.org
Fri Jun 29 14:31:15 CEST 2012
#7019: Wrong error message when using forall in constraints
---------------------------------+------------------------------------------
Reporter: sjoerd_visscher | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.1
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by sjoerd_visscher):
Apparently it is allowed to use forall in constraints (I just saw that
[http://stackoverflow.com/questions/11258536/how-to-put-constraints-on-
the-associated-data here]). I used the type synonym as a workaround, but
that's not needed, so here's a simplified case:
{{{
{-# LANGUAGE ConstraintKinds, RankNTypes, UndecidableInstances #-}
import Data.Monoid
newtype Free a = Free { runFree :: forall r. Monoid r => (a -> r) -> r }
instance (forall a. Monoid (Free a)) => Monad (Free) where
return a = Free ($ a)
(>>=) = runFree
}}}
gives the error
{{{
Could not deduce (Monoid (Free b)) arising from a use of `runFree'
from the context (forall a. Monoid (Free a))
}}}
I replaced the constaint variable with Monoid, to check that that's not
the problem. So this new version of course has a simple workaround, but
that workaround is not available in the constraint variable version.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7019#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list