[Haskell-cafe] Type system trickery

Niklas Broberg niklas.broberg at gmail.com
Mon Jun 22 15:10:57 EDT 2009


> Not nearly as annoying as this:
>
>  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*

Well, that means something very different obviously. It means Zoo
constructors can never take Zoo arguments, so you could only have at
most one Zoo constructor at the outermost level, having either a Foo
or a Bar inside it. Why would that give you type check errors? If it
does, you're doing something else wrong.

Cheers,

/Niklas


More information about the Haskell-Cafe mailing list