
13 Jul
2009
13 Jul
'09
12:20 p.m.
On Mon, Jul 13, 2009 at 12:41 PM, Kev
Mahoney
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.
As such this type is pretty useless, since you don't know anything about a, you can't do anything with it... Which is why you add typeclass constraints, so you can use this value. Data.Dynamic adds a Typeable constraint, which allows you to do safe coercing, so you can have a "typecase", if not like you tried to do it. -- Jedaï