[Haskell-cafe] How to check object's identity?

Xie Hanjian jan.h.xie at gmail.com
Sat Jan 3 10:51:12 EST 2009


Thanks guys :-)

* Nicolas Pouillard <nicolas.pouillard at gmail.com> [2009-01-03 16:39:59 +0100]:

> Excerpts from Xie Hanjian's message of Sat Jan 03 16:28:30 +0100 2009:
> > Hi,
> > 
> > I tried this in ghci:
> > >Prelude> 1:2:[] == 1:2:[]
> > True
> > 
> > Does this mean (:) return the same object on same input, or
> > (==) is not for identity checking? If the later is true, how
> > can I check two object is the *same* object?
> 
> Here (==) is the structural equality. There is generally no exposed function
> to check for identity of values. This would expose too much of the memory
> model and the compilation process to give a specification to such a function.
> 
> -- 
> Nicolas Pouillard

-- 
jan=callcc{|jan|jan};jan.call(jan)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090103/2ddf3db7/attachment.bin


More information about the Haskell-Cafe mailing list