[Haskell-cafe] deriving Data.HashTable - stack overflow
Lyle Kopnicky
lists at qseep.net
Fri Aug 9 08:29:02 CEST 2013
I chose not to introduce another dependency. I just implemented the hash
function by delegating to the Show instance of the nested type:
data ValType = FloatType | IntType | StringType
deriving (Show,Eq)
data VarName = VarName ValType String
deriving (Show,Eq)
instance Hashable VarName where
hash (VarName t n) = hash (show t ++ n)
Not super-efficient, but it'll be fine. The printString function (defined
in that other package) uses a single character prefix for each ValType.
- Lyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130808/f25551fa/attachment.htm>
More information about the Haskell-Cafe
mailing list