On Mon, Jul 13, 2009 at 12:41 PM, Kev
Mahoney<[email protected]> wrote:
> 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ï
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to