You can't. The type can't be known, unfortunately.
Hi,
while this works:
data Foo a = Foo a
unwrapFoo :: Foo a -> aunwrapFoo (Foo x) = x
this:
{-# LANGUAGE ExistentialQuantification #-}
class BarLike a wheredoSomething :: a -> Double
data Bar = forall a. BarLike a => Bar a
unwrapBar :: Bar -> aunwrapBar (Bar x) = x
gives me:
Couldn't match expected type `a' against inferred type `a1'`a' is a rigid type variable bound bythe type signature for `unwrapBar' at test.hs:8:20`a1' is a rigid type variable bound bythe constructor `Bar' at test.hs:9:11In the expression: xIn the definition of `unwrapBar': unwrapBar (Bar x) = x
How can i deconstruct the enclosed value of type a?
Thanks,Lenny
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe