Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added an instance for Map. #2

Closed
wants to merge 1 commit into from

2 participants

@leepike

No description provided.

@patperry
Owner

Thanks for this, but I don't think it makes sense to add a dependency on "containers".

@patperry patperry closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 16, 2011
  1. @leepike

    Added an instance for Map.

    leepike authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 1 deletion.
  1. +7 −0 Data/AEq.hs
  2. +3 −1 ieee754.cabal
View
7 Data/AEq.hs
@@ -17,6 +17,7 @@ import Foreign
import Foreign.C.Types
import Data.Complex
import Numeric.IEEE
+import qualified Data.Map as M
infix 4 ===, ~==
@@ -201,6 +202,12 @@ instance (AEq a) => AEq [a] where
(~==) = eqListsWith (~==)
{-# INLINE (~==) #-}
+instance (AEq k, AEq a) => AEq (M.Map k a) where
+ (===) m1 m2 = M.toList m1 === M.toList m2
+ {-# INLINE (===) #-}
+ (~==) m1 m2 = M.toList m1 ~== M.toList m2
+ {-# INLINE (~==) #-}
+
instance (AEq a) => AEq (Maybe a) where
(===) Nothing Nothing = True
(===) (Just x) (Just y) = (===) x y
View
4 ieee754.cabal
@@ -31,7 +31,9 @@ library
extensions: FlexibleInstances
ForeignFunctionInterface
- build-depends: base >= 3 && < 5
+ build-depends: base >= 3 && < 5,
+ containers >= 0.3
+
ghc-options: -Wall
Something went wrong with that request. Please try again.