[Haskell-cafe] Re: Comparing GADTs for Eq and Ord
ganesh at earth.li
Mon Sep 15 17:53:57 EDT 2008
On Mon, 15 Sep 2008, Tom Hawkins wrote:
> OK. But let's modify Expr so that Const carries values of different types:
> data Expr :: * -> * where
> Const :: a -> Term a
> Equal :: Term a -> Term a -> Term Bool
> How would you then define:
> Const a === Const b = ...
Apart from the suggestions about Data.Typeable etc, one possibility is to
enumerate the different possible types that will be used as parameters to
Const in different constructors, either in Expr or in a new type.
So IntConst :: Int -> Expr Int, etc
Or Const :: Const a -> Expr a and IntConst :: Int -> Const Int etc
Not very pleasant though.
More information about the Haskell-Cafe