
Hello list.
I have a problem with Data.Dynamic. The problem is probably that I don't
understand it. From my understanding, the following program should work:
-8<------------------------
import Data.Dynamic
data Foo = Foo { x :: Int }
deriving Show
instance Typeable Foo where
typeOf _ = mkAppTy (mkTyCon "Foo.Foo") []
main = do
let dynObj = toDyn $ Foo 42
print dynObj
let Just obj = fromDynamic dynObj :: Maybe Foo
print obj
-8<------------------------
But when I compile it (ghc Foo.hs) and run it (./a.out) I get:
<