
13 Jul
2009
13 Jul
'09
6:41 a.m.
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 appreciated. Thanks, Kevin.