Real world use of GADT
Is there any good resource on real use of Generalized Abstract Data Type? The example given in the haskell wikibook is too short to give me an insight of the real possibilities of GADT. Thanks ...
Is there any good resource on real use of Generalized Abstract Data Type? The example given in the haskell wikibook is too short to give me an insight of the real possibilities of GADT. Thanks ...
I started reading about GADT in Haskell Wiki but didn't feel quite comfortable understanding it. Do you recommend a specific book chapter or a blog post explaining GADT for a Haskell beginner? ...
Suppose we define a GADT for comparison of types: data EQT a b where Witness :: EQT a a Is it then possible to declare a function eqt with the following type signature: eqt :: (Typeable a, Typeable b) => a -> b -> Maybe (EQT a b) ...such that eqt x y evaluates to Just Witness if typeOf x == typeOf y --- and otherwise to Nothing? ...
Given a simple language, say data E where ValE :: Typeable a => a -> E AppE :: E -> E -> E is it then possible to transform it into a typed representation: data T a where ValT :: Typeable a => a -> T a AppT :: T (a -> b) -> T a -> T b deriving Typeable I have tried various approaches, e.g. the following: e2t :: Typeable ...