[Haskell-cafe] Proposal: deriving ShallowEq?

Ben Lippmeier Ben.Lippmeier at anu.edu.au
Tue Jul 19 06:16:35 EDT 2005

Bulat Ziganshin wrote:

> reading GHC sources is always very interesting :)
> that is from GHC/Base.hs :

> getTag :: a -> Int#
> getTag x = x `seq` dataToTag# x

! This is just what I was looking for, thankyou.

My shallowEq function is now simply:

shallowEq :: a -> a -> Bool
shallowEq a b = getTag a ==# getTag b

My project is already totally reliant on GHC, and this will save me the 
heartache of hacking DrIFT (which I was in the process of setting up 
when I saw this mail) into my makefile.

Portability be damned!


More information about the Haskell-Cafe mailing list