[Haskell-cafe] GADTs and Typeclasses

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Sun Apr 15 11:54:10 EDT 2007

Will I run into problems using typeclasses with GADTs? I've come up with this 
to model a fragment of ASN.1. I'd hate to spend a lot of time on this only to 
find out it's well known that these two features don't mix very well.

Thanks, Dominic.

data Type :: * -> * where
   INTEGER             :: Type Int
   BOOLEAN             :: Type Bool
   BITSTRING           :: Type BitString
   NUMERICSTRING       :: Type NumericString
   ReferencedType      :: Type () -- for now
   ConstrainedType     :: Type a -> Constraint a -> Type a
   SizeConstrainedType :: Size a => Type a -> Constraint Int -> Type a
   FromConstrainedType :: From a => Type a -> Constraint a -> Type a

More information about the Haskell-Cafe mailing list