Rodrigo Setti created THRIFT-1927:
-------------------------------------

             Summary: Add Haskell required Hashable instances
                 Key: THRIFT-1927
                 URL: https://issues.apache.org/jira/browse/THRIFT-1927
             Project: Thrift
          Issue Type: Bug
          Components: Haskell - Library
            Reporter: Rodrigo Setti


Some higher level structures are not working because they're not Hashable. The 
following code fix that - it should probably live in Thrift main module:

{noformat}
import Data.Hashable (Hashable)
import qualified Data.HashMap.Strict as Map
import qualified Data.HashSet as Set
import qualified Data.Vector as Vector 

instance Hashable a => Hashable (Vector.Vector a) where                         
    
    hashWithSalt s v = hashWithSalt s $ Vector.toList v                         
    
                                                                                
    
instance (Hashable a, Hashable b) => Hashable (Map.HashMap a b) where           
    
    hashWithSalt s v = hashWithSalt s $ Map.toList v          
                                                                                
    
instance Hashable a => Hashable (Set.HashSet a) where                           
    
    hashWithSalt s v = hashWithSalt s $ Set.toList v
{noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to