On Tue, Feb 06, 2007 at 04:58:28PM +0100, Alfonso Acosta wrote:
> Hi all,
> 
> Reading the sources of Lava (a Haskell Hardware Description DSL) I run
> into this definition ...
> 
> 
> unsafeCoerce :: a -> b
> unsafeCoerce a = unsafePerformIO $
>  do writeIORef ref a
>     readIORef ref
> where
>  ref = unsafePerformIO $
>    do newIORef undefined
> 
> Is this actually equivalent to the infamous unsafeCoerce# ?

Certainly not in jhc. However, In jhc one can use unsafeCoerce__ which
is provided in Jhc.Prim. An important restriction on using it in jhc
that might not be obvious is that you must not 'seq' a value that has
been coerced to another type.
        
        John

-- 
John Meacham - ⑆repetae.net⑆john⑈
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to