On Wed, Apr 25, 2007 at 03:22:33AM +0200, Twan van Laarhoven wrote: > 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.
Be sure to actually check the details - Twan's code is documented as not working. (GHC does naughty things when it thinks it knows the type, and you need to use a couple of nonportable hacks to make it work) Stefan _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
