On Tue, Dec 8, 2009 at 1:48 AM, Michael Vanier <mvanie...@gmail.com> wrote:
> Do you mean symbols as in "interned strings with an O(1) string comparison
> method"?  I would love to have those, but I don't see an easy way to get it
> without being in the IO or ST monad.

data Sym = Sym String Hash

fromString :: String -> Sym
fromString s = Sym s (hash s)

instance Eq Sym where
    Sym _ h == Sym _ h' = h == h'

Much as I am uncomfortable with hash-based equality.  1/2^256, despite
being very small, is not zero.  It is begging for a mysterious failure
someday.

Luke
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to