[Haskell-cafe] Are GADTs what I need?

Kev Mahoney maillist at kevinmahoney.co.uk
Mon Jul 13 06:41:25 EDT 2009

Hi there,

I'm currently writing an interpreter that I would like to be able to
use with other haskell programs. I would like to be able to pass along
arbitrary types though the interpreter. I've seen hints that GADTs can
do this, but I am having trouble understanding them.

So far, I've learnt you can do this:

data Value where
VInt :: Integer -> Value
VWrapper :: a -> Value

which can let you encode arbitrary 'dynamic' types into Value. I was
hoping to be able to pattern match to get the value out again e.g.

doSomething :: Value -> ....
doSomething (VWrapper String s) = .....

Also, anything that can help me out with GADTs in general will be much


More information about the Haskell-Cafe mailing list