Here's another way to do it:
data ValType = FloatType | IntType | StringType
deriving (Show,Eq)
instance Hashable ValType where
hash FloatType = 0
hash IntType = 1
hash StringType = 2
data VarName = VarName ValType String
deriving (Show,Eq)
instance Hashable VarName where
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 w
Ah, thanks, folks!
I'll just implement my own hashing by generating a string and calling the
hash function on that. That's what I was doing in the old version of my
code, anyway.
It's just that in the core Data.HashTable, you had to provide a hash
function, so the point where I used the hash tabl
There is a ticket with discussion and a patch here [0].
Erik
[0] http://ghc.haskell.org/trac/ghc/ticket/7633
On Thu, Aug 8, 2013 at 8:11 PM, David Thomas wrote:
> I do wish there was a compiler-checked way of specifying a minimum complete
> definition.
>
>
> On Thu, Aug 8, 2013 at 11:02 AM, Joe
I do wish there was a compiler-checked way of specifying a minimum complete
definition.
On Thu, Aug 8, 2013 at 11:02 AM, Joey Adams wrote:
> On Thu, Aug 8, 2013 at 12:22 PM, Lyle Kopnicky wrote:
>
>> ...
>>
>>
>> So I went to the Data.Hashable page and looked up examples on how to
>> derive a H
On Thu, Aug 8, 2013 at 12:22 PM, Lyle Kopnicky wrote:
> ...
>
> So I went to the Data.Hashable page and looked up examples on how to
> derive a Hashable instance for my datatype:
>
> http://hackage.haskell.org/packages/archive/hashable/latest/doc/html/Data-Hashable.html
>
> The problem occurs eve