I'm getting some _really_ weird results under ghci from the unsafePtrEq
I'm using (thanks to Sigbjorn). It works fine under ghc. I'm running
5.03.20020208 under Windows XP. Is there a work-around, perhaps via a
different implementation of unsafePtrEq? - Conal
module Main where
import PrelGHC
unsafePtrEq :: a -> a -> Bool
unsafePtrEq a b = (unsafeCoerce# a) `eqAddr#` (unsafeCoerce# b)
main = do print $ 1 `unsafePtrEq` 1
print $ 1 `unsafePtrEq` 1 || True
{- Results:
bash-2.05a$ ghci TestPtrEq
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 5.03, for Haskell
98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package std ... linking ... done.
Loading package lang ... linking ... done.
Loading package concurrent ... linking ... done.
Loading package util ... linking ... done.
Loading package text ... linking ... done.
Loading package data ... linking ... done.
Compiling TestPtrEq ( TestPtrEq.hs, interpreted )
Ok, modules loaded: TestPtrEq.
Main> main
False
TestPtrEq>
It works, however, under ghc:
bash-2.05a$ ghc -fglasgow-exts -o test.exe TestPtrEq.hs
bash-2.05a$ ./test.exe
True
True
-}
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs