Re: [Haskell-cafe] Portable implementation of unsafeCoerce

2007-02-08 Thread John Meacham
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 =

[Haskell-cafe] Portable implementation of unsafeCoerce

2007-02-06 Thread Alfonso Acosta
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

Re: [Haskell-cafe] Portable implementation of unsafeCoerce

2007-02-06 Thread Neil Mitchell
Hi Alfonso, Reading the sources of Lava (a Haskell Hardware Description DSL) I run into this definition ... unsafeCoerce :: a - b Is this actually equivalent to the infamous unsafeCoerce# ? Yes, see the comment in the haddock documentation for unsafePerformIO: