Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
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

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
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

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
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

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Erik Hesselink
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

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread David Thomas
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

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Joey Adams
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