[Haskell] ANN: IOSpec 0.1

Twan van Laarhoven twanvl at gmail.com
Tue Apr 24 21:22:33 EDT 2007

Wouter Swierstra wrote:
>             Test.IOSpec    Version 1.0
Shouldn't that be 0.1?

>   * Test.IOSpec.Teletype: a specification of getChar and putChar.

You use Dynamic for the data type in IORefs, this has the unfortunate 
consequence of needing Typeable constraints. You could try to use 
unsafeCoerce instead,
 > type Data = ()
 > unsafeToData :: a -> Data
 > unsafeToData = unsafeCoerce
 > unsafeFromData :: Data -> a
 > unsafeFromData = unsafeCoerce

I think this should be just as safe as Dynamic, since internally Dynamic 
uses unsafeCoerce as well. Just steal the details from there.


More information about the Haskell mailing list