[Haskell-cafe] Type system trickery
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Tue Jun 23 19:36:11 EDT 2009
On Jun 22, 2009, at 14:43 , Andrew Coppin wrote:
> data Foobar a where
> Foo :: X -> Y -> Foobar NoZoo
> Bar :: X -> Y -> Foobar NoZoo
> Zoo :: Foobar NoZoo -> Foobar Zoo
>
> For some reason, if I do this I get endless type check errors. I
> have to change the top two back to Foobar a before it will work.
> *sigh*
That's probably because ghc can't fix a type for Foobar a if you never
actually use a anywhere. Functional dependencies could solve that,
but giving ghc a way to infer a type for it by using it where it
doesn't affect anything important is easier and doesn't risk
possible(?) weird interactions between FDs and GADTs.
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090623/8cba3cb3/PGP.bin
More information about the Haskell-Cafe
mailing list