Difference between revisions of "Talk:Physical equality"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
+ | Should the code not be |
||
+ | <haskell> |
||
+ | x === y = unsafePerformIO $ do |
||
+ | px <- x `seq` newStablePtr x |
||
+ | py <- y `seq` newStablePtr y |
||
+ | let ret = px == py |
||
+ | freeStablePtr px |
||
+ | freeStablePtr py |
||
+ | return ret |
||
+ | </haskell> |
||
+ | ? |
||
+ | |||
+ | --David M, 20 Dec 2010 |
||
+ | |||
GHC already has physical equality testing via GHC.Exts.reallyUnsafePtrEquality# |
GHC already has physical equality testing via GHC.Exts.reallyUnsafePtrEquality# |
||
Revision as of 02:03, 20 December 2010
Should the code not be
x === y = unsafePerformIO $ do
px <- x `seq` newStablePtr x
py <- y `seq` newStablePtr y
let ret = px == py
freeStablePtr px
freeStablePtr py
return ret
?
--David M, 20 Dec 2010
GHC already has physical equality testing via GHC.Exts.reallyUnsafePtrEquality#
--Lemmih 15:00, 29 July 2006 (UTC)
No need to talk about OCaml's nan:
Prelude> 0/0
NaN
Prelude> 0/0 == 0/0
False