[GHC] #6074: Instance inference failure with GADTs
GHC
cvs-ghc at haskell.org
Fri May 4 14:09:11 CEST 2012
#6074: Instance inference failure with GADTs
------------------------------+---------------------------------------------
Reporter: goldfire | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.5 | Keywords: GADTs
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Comment(by dreixel):
I think this is a feature request. Indeed michalt points out that this
cannot work in the way presented. But what if we use `XDataKinds`?
{{{
data Index = TInt | TBool
data GADT (a :: Index) where
GInt :: GADT TInt
GBool :: GADT TBool
class Stringable a where
toString :: a -> String
instance Stringable (GADT TInt) where
toString _ = "constructor GInt"
instance Stringable (GADT TBool) where
toString _ = "constructor GBool"
mkString :: GADT a -> String
mkString g = toString g
}}}
Now we know that the instances of `Stringable` for `GADT a` cover all
possible types of `a`!
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6074#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list