Permalink
Browse files

AEq instances for Quantity and Vec.

  • Loading branch information...
1 parent 91109a4 commit 13c7ed674b77c61757ed151ca09ad5cd703154e1 @bjornbm committed May 26, 2011
Showing with 21 additions and 1 deletion.
  1. +18 −0 Numeric/Units/Dimensional/AEq.hs
  2. +3 −1 dimensional-experimental.cabal
@@ -0,0 +1,18 @@
+{-# LANGUAGE TypeSynonymInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving #-}
+
+-- | Provides instances of @Data.AEq.AEq@ from the ieee754 library.
+module Numeric.Units.Dimensional.AEq where
+
+import Numeric.Units.Dimensional (Dimensional (Dimensional), Quantity)
+import Numeric.Units.Dimensional.LinearAlgebra.Vector (Vec (ListVec))
+import Data.AEq
+
+
+deriving instance AEq a => AEq (Quantity d a)
+
+instance (Floating a, AEq a) => AEq (Vec ds a) -- CPos et al
+ where
+ ListVec xs === ListVec ys = and $ zipWith (===) xs ys
+ ListVec xs ~== ListVec ys = and $ zipWith (~==) xs ys
@@ -28,11 +28,13 @@ Build-Depends:
numtype < 1.1,
HList >= 0.2.1 && < 0.3,
numeric-quest < 0.2,
- ad >= 0.44.4 && < 1.1
+ ad >= 0.44.4 && < 1.1,
+ ieee754 >= 0.7.3 && < 1.1
Exposed-Modules:
Numeric.Units.Dimensional.AD
+ Numeric.Units.Dimensional.AEq
Numeric.Units.Dimensional.Constants
Numeric.Units.Dimensional.Formulae
Numeric.Units.Dimensional.LinearAlgebra.VectorAD

0 comments on commit 13c7ed6

Please sign in to comment.