[Haskell-cafe] Physical equality

Vo Minh Thu noteed at gmail.com
Mon Jun 28 04:41:13 EDT 2010


2010/6/28 José Romildo Malaquias <j.romildo at gmail.com>:
> Is there in Haskell a non monadic function of type a -> a -> Bool which
> test for physical equality of two values? It would return True if only
> if both values are the same object in memory.
>
> For instance:
>
>  value1 = "good"
>  value2 = "good"
>
>  eq value1 value2 => False
>
>  value1 = "good"
>  value2 = value1
>
>  eq value1 value2 => True

Not exactly what you ask for, but quite close:
http://www.haskell.org/ghc/docs/6.12.1/html/libraries/base/System-Mem-StableName.html

Cheers,
Thu


More information about the Haskell-Cafe mailing list