1 {-# LANGUAGE DeriveDataTypeable #-}
2 module Hcompta.Amount.Style where
6 import Data.Word (Word8)
7 import Data.Typeable ()
13 { fractioning :: Maybe Fractioning
14 , grouping_integral :: Maybe Grouping
15 , grouping_fractional :: Maybe Grouping
16 , precision :: Precision
17 -- TODO: , sign_plus :: Maybe Bool
18 , unit_side :: Maybe Side
19 , unit_spaced :: Maybe Spacing
20 } deriving (Data, Eq, Ord, Read, Show, Typeable)
21 instance NFData Style where
22 rnf (Style f gi gf p ui up) =
35 deriving (Data, Eq, Ord, Read, Show, Typeable)
36 instance NFData Grouping where
37 rnf (Grouping s d) = rnf s `seq` rnf d
48 deriving (Data, Eq, Ord, Read, Show, Typeable)
49 instance NFData Side where
58 { fractioning = Nothing
59 , grouping_integral = Nothing
60 , grouping_fractional = Nothing
63 , unit_spaced = Nothing
68 union :: Style -> Style -> Style
71 { fractioning=fractioning_
72 , grouping_integral=grouping_integral_
73 , grouping_fractional=grouping_fractional_
74 , precision=precision_
79 { fractioning=fractioning'
80 , grouping_integral=grouping_integral_'
81 , grouping_fractional=grouping_fractional_'
82 , precision=precision'
90 { fractioning=maybe fractioning' (const fractioning_) fractioning_
91 , grouping_integral=maybe grouping_integral_' (const grouping_integral_) grouping_integral_
92 , grouping_fractional=maybe grouping_fractional_' (const grouping_fractional_) grouping_fractional_
93 , precision=max precision_ precision'
94 , unit_side=maybe side' (const side) side
95 , unit_spaced=maybe spaced' (const spaced) spaced