Correction : LambdaCase n’est pas dans ghc-7.4 (Debian/wheezy)
[comptalang.git] / lib / Hcompta / Model / Amount / Quantity.hs
index 22dfd4ef7d6311d1ecd27da035cbe8eb7f406df2..1ce1f385c46251bdc753357663859cf48e8068fd 100644 (file)
@@ -24,29 +24,31 @@ deriving instance Data Quantity
 #endif
 
 representation :: String
-null :: Quantity
-is_zero :: Word8 -> Quantity -> Bool
+nil :: Quantity
+is_zero :: Quantity -> Bool
 round :: Word8 -> Quantity -> Quantity
 #ifdef DOUBLE
 representation = "Double"
-null = 0.0
+nil = 0.0
 
-round :: fromInteger $ round $ (f * (10^n)) / (10.0^^n)
+round n f = fromInteger $ round $ (f * (10^n)) / (10.0^^n)
 
-is_zero decimal_places quantity =
-       floor quantity == 0 && -- NOTE: check integral part, in case of an overflow in roundTo'
-       0 == roundTo' decimal_places quantity
-       where
-               roundTo' n f = fromInteger $ round $ f * (10 ^ n)
+is_zero = (== 0) . decimalMantissa
+--is_zero decimal_places quantity =
+--     floor quantity == 0 && -- NOTE: check integral part, in case of an overflow in roundTo'
+--     0 == roundTo' decimal_places quantity
+--     where
+--             roundTo' n f = fromInteger $ round $ f * (10 ^ n)
 
 #else
 representation = "Decimal"
-null = fromInteger 0
+nil = fromInteger 0
 
 round = Data.Decimal.roundTo
 
-is_zero decimal_places quantity =
-       (== 0) $ decimalMantissa $
-       Hcompta.Model.Amount.Quantity.round decimal_places quantity
+is_zero = (== 0) . decimalMantissa
+--is_zero decimal_places quantity =
+--     (== 0) $ decimalMantissa $
+--     Hcompta.Model.Amount.Quantity.round decimal_places quantity
 #endif