1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE TypeFamilies #-}
4 module Hcompta.Amount where
6 import Data.Data (Data)
7 import Data.Eq (Eq(..))
8 import Data.Function ((.))
9 import Data.Ord (Ord(..), Ordering)
10 import Data.Tuple (fst, snd)
12 import Hcompta.Quantity
13 import Hcompta.Unit (Unit(..))
19 , Eq (Amount_Quantity a)
20 , Zero (Amount_Quantity a)
21 , Unit (Amount_Unit a)
23 type Amount_Quantity a
25 amount_quantity :: a -> Amount_Quantity a
26 amount_unit :: a -> Amount_Unit a
27 instance -- Type (unit, quantity)
31 ) => Amount (unit, quantity) where
32 type Amount_Quantity (unit, quantity) = quantity
33 type Amount_Unit (unit, quantity) = unit
39 , Ord (Amount_Quantity a)
42 amount_sign = quantity_sign . amount_quantity