27 Jun 2012 23:41
Strange behavior when using stable names inside ghci?
Facundo Domínguez <facundominguez <at> gmail.com>
2012-06-27 21:41:11 GMT
2012-06-27 21:41:11 GMT
Hi,
The program below when loaded in ghci prints always False, and when
compiled with ghc it prints True. I'm using ghc-7.4.1 and I cannot
quite explain such behavior. Any hints?
Thanks in advance,
Facundo
{-# LANGUAGE GADTs #-}
import System.Mem.StableName
import Unsafe.Coerce
import GHC.Conc
data D where
D :: a -> b -> D
main = do
putStr "type enter"
s <- getLine
let i = fromEnum$ head$ s++"0"
d = D i i
case d of
D a b -> do
let a' = a
sn0 <- pseq a'$ makeStableName a'
sn1 <- pseq b$ makeStableName b
print (sn0==unsafeCoerce sn1)
RSS Feed