Ajout : Makefile : %/install/test
[comptalang.git] / lib / Hcompta / Format / Ledger / Write.hs
index 4af9fc73e2540d5a950ef59eab95e55250c161eb..f1fa742c5ad1779249d3f94844fc696d045b0e4d 100644 (file)
@@ -9,7 +9,9 @@ import           Control.Arrow ((***))
 import           Data.Decimal (DecimalRaw(..))
 import qualified Data.Char (isSpace)
 import           Data.Fixed (showFixed)
+import qualified Data.Foldable
 import qualified Data.List
+import qualified Data.List.NonEmpty
 import qualified Data.Map.Strict as Data.Map
 import           Data.Maybe (fromMaybe)
 import qualified Data.Text.Lazy as TL
@@ -65,9 +67,10 @@ account type_ =
                account_ :: Account -> Doc
                account_ acct =
                        W.align $ W.hcat $
-                               Data.List.intersperse
-                                (W.bold $ W.dullblack $ W.char Read.account_name_sep)
-                                (Data.List.map account_name acct)
+                               Data.List.NonEmpty.toList $
+                               Data.List.NonEmpty.intersperse
+                                (W.bold $ W.yellow $ W.char Read.account_name_sep)
+                                (Data.List.NonEmpty.map account_name acct)
 
 account_name :: Account.Name -> Doc
 account_name = W.strict_text
@@ -76,9 +79,9 @@ account_name = W.strict_text
 
 account_length :: Posting.Type -> Account -> Int
 account_length type_ acct =
-       Data.List.foldl
+       Data.Foldable.foldl
         (\acc -> (1 +) . (acc +) . Text.length)
-        (if acct == [] then 0 else (- 1)) acct +
+        (- 1) acct +
        case type_ of
         Posting.Type_Regular -> 0
         Posting.Type_Virtual -> 2
@@ -142,7 +145,7 @@ quantity Style.Style
                sign <> do
                W.bold $ W.blue $ do
                        W.text (TL.pack $ maybe id (\g -> reverse . group g . reverse) grouping_integral $ int) <> do
-                       W.char (fromMaybe default_fractioning fractioning) <> do
+                       (W.yellow $ W.char (fromMaybe default_fractioning fractioning)) <> do
                        W.text (TL.pack $ maybe id group grouping_fractional frac)
        where
                group :: Style.Grouping -> [Char] -> [Char]