Permalink
Browse files

Introduce a Hashable instance for Ordering

  • Loading branch information...
1 parent 607c196 commit b0715b7b2d4833939dfb23a0a7450cdd54c4afa1 @bos bos committed Sep 22, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 Data/Hashable.hs
View
5 Data/Hashable.hs
@@ -153,6 +153,11 @@ class Hashable a where
instance Hashable () where hash _ = 0
+instance Hashable Ordering where
+ hash LT = 0xd035ce52b17a94b4
+ hash EQ = 0x65886b5361a4db93
+ hash GT = 0x731e59547a3d470d
+
instance Hashable Bool where hash x = case x of { True -> 1; False -> 0 }
instance Hashable Int where hash = id

3 comments on commit b0715b7

@hvr

just wondering, why does Ordering have such high magic numbers, whereas Bool just uses the less magic numbers 0 and 1? should Bool be made to use hash values with more entropy as well?

@tibbe
Owner

@hvr See #30

@hvr
Please sign in to comment.