[Haskell-cafe] type variable in class instance

Corentin Dupont corentin.dupont at gmail.com
Tue Sep 11 00:06:15 CEST 2012


Hi Stephen,
I wasn't aware of Data.Dynamic.
I tried:

*viewEvent :: Dynamic -> IO ()
viewEvent event = do
   case fromDynamic event of
        Nothing -> return ()
        Just (Message s) -> putStrLn $ show s*

But still got the same error (Ambiguous type variable `t0' in the
constraint:  (Typeable t0) arising from a use of `fromDynamic')...

Best,
Corentin


On Mon, Sep 10, 2012 at 11:33 PM, Stephen Tetley
<stephen.tetley at gmail.com>wrote:

> Whilst dynamic typing isn't idiomatic for Haskell, it seems like
> you've decided you want it. So why not use Data.Dynamic rather than
> roll you're own dynamic typing with Typeable?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120911/df7d2106/attachment.htm>


More information about the Haskell-Cafe mailing list