You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Rodrigo Setti (JIRA)" <ji...@apache.org> on 2013/04/10 21:35:17 UTC

[jira] [Closed] (THRIFT-1927) Add Haskell required Hashable instances

     [ https://issues.apache.org/jira/browse/THRIFT-1927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rodrigo Setti closed THRIFT-1927.
---------------------------------

    Resolution: Invalid
    
> 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