Tue May 4 16:10:29 EDT 2010

Object identity in Haskell

One of the weird concepts in Haskell is that objects have no
`intrinsic ID'.  Pointer equality (an external map that relates memory
addresses to language objects) is a side effect!

More specifically: objects do not exist, only values.  If values need
to be compared for equality, this needs to be explicitly implemented
as an Eq instance.

In more than one occasion I've felt the need to think of values as
objects with a distinct identity, especially thinking about nodes in a
graph, and adding connections.

Whenever I run into the problem of needing node identity, what I
really want is binding structure, or at least some staging/macro step
that can create binding structure from

What I learned is that even if it might not be trivial, it is usually
possible to write keep nodes as variables and write function
abstractions in Haskell that do the same thing.  Esentially, using
something akin to higher order syntax.

This is one of those "deep differences" of functional programming that
take some getting used to.  I definitely need some more practice.