[Haskell-cafe] Efficient object identity (aka symbols as data)

Brandon Allbery allbery.b at gmail.com
Thu May 26 21:05:42 CEST 2011


On Thu, May 26, 2011 at 14:56, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> My understanding is that if you have a constructor with no fields, it gets
> allocated as a compile-time constant. In other words, "C" is just a pointer
> to a static data structure somewhere in the program binary, and (==)
> effectively becomes pointer equity.

When used as a general function, at least; my understanding is that
it's usually reduced to an integer tag (and that this is relied on to
do fast conversions internally)



More information about the Haskell-Cafe mailing list