1 {-# LANGUAGE NoMonomorphismRestriction #-}
2 {-# LANGUAGE UndecidableInstances #-}
5 ( module Hcompta.LCC.Sym
6 , module Hcompta.LCC.Sym.Account
7 , module Hcompta.LCC.Sym.Addable
8 , module Hcompta.LCC.Sym.Amount
9 , module Hcompta.LCC.Sym.Chart
10 , module Hcompta.LCC.Sym.Compta
11 , module Hcompta.LCC.Sym.Date
12 , module Hcompta.LCC.Sym.FileSystem
13 , module Hcompta.LCC.Sym.Journal
14 , module Hcompta.LCC.Sym.Negable
15 , module Hcompta.LCC.Sym.Posting
16 , module Hcompta.LCC.Sym.Quantity
17 , module Hcompta.LCC.Sym.Subable
18 , module Hcompta.LCC.Sym.Transaction
19 , module Hcompta.LCC.Sym.Unit
20 , module Hcompta.LCC.Sym.Zipper
23 import Hcompta.LCC.Sym.Account
24 import Hcompta.LCC.Sym.Addable
25 import Hcompta.LCC.Sym.Amount
26 import Hcompta.LCC.Sym.Chart
27 import Hcompta.LCC.Sym.Compta
28 import Hcompta.LCC.Sym.Date
29 import Hcompta.LCC.Sym.FileSystem
30 import Hcompta.LCC.Sym.Journal
31 import Hcompta.LCC.Sym.Negable
32 import Hcompta.LCC.Sym.Posting
33 import Hcompta.LCC.Sym.Quantity
34 import Hcompta.LCC.Sym.Subable
35 import Hcompta.LCC.Sym.Transaction
36 import Hcompta.LCC.Sym.Unit
37 import Hcompta.LCC.Sym.Zipper
39 import qualified Hcompta.LCC.Account as LCC
40 import qualified Hcompta.LCC.Amount as LCC
41 import qualified Hcompta.LCC.Chart as LCC
42 import qualified Hcompta.LCC.Compta as LCC
43 import qualified Hcompta.LCC.Journal as LCC
44 import qualified Hcompta.LCC.Posting as LCC
45 import qualified Hcompta.LCC.Source as LCC
46 import qualified Hcompta.LCC.Transaction as LCC
47 import qualified Hcompta as H
49 import Control.Applicative (Applicative, Alternative)
50 import Data.Bool (Bool)
51 import Data.Either (Either(..))
53 import Data.Foldable (Foldable)
54 import Data.Map.Strict (Map)
55 import Data.List.NonEmpty (NonEmpty(..))
56 import Data.Maybe (Maybe)
57 import Data.NonNull (NonNull)
60 import Data.Traversable (Traversable)
61 import Data.TreeMap.Strict.Zipper (Zipper)
62 import Text.Show (Show)
64 type SS = Proxy (LCC.Compta SRC SS') ': SS'
65 type SRC = LCC.Source (NonEmpty LCC.SourcePos) SS'
86 , Proxy LCC.Transaction
100 = Error_App_not_applicable
101 | Error_App_type_mismatch (Sym.EType cs) (Sym.EType cs)
105 :: Sym.Inj_TyConst cs (->)
106 => Sym.ETermClosed cs is
107 -> Sym.ETermClosed cs is
108 -> Either (Error_App cs) (Sym.ETermClosed cs is)
109 app (Sym.ETermClosed ty_f (Sym.TermClosed te_f))
110 (Sym.ETermClosed ty_a (Sym.TermClosed te_a)) =
112 ty_fun Sym.:$ ty_arg Sym.:$ ty_res
113 | Just Refl <- Sym.kind_of ty_fun `Sym.eq_skind` (Sym.kind::Sym.SKind (Kind.Type -> Kind.Type -> Kind.Type))
114 , Just Refl <- ty_fun `Sym.eq_Type` Sym.ty @(->) ->
115 case ty_arg `Sym.eq_Type` ty_a of
116 Just Refl -> Right $ Sym.ETermClosed ty_res $ Sym.TermClosed $ te_f Sym..$ te_a
117 Nothing -> Left $ Error_App_type_mismatch (Sym.EType ty_arg) (Sym.EType ty_a)
118 _ -> Left $ Error_App_not_applicable
119 feed_args :: Sym.TermAVT src -> [Sym.TermAVT src] -> Sym.TermAVT src
120 feed_args te as = go te as
125 Right f' -> f' `go` as
126 Left _err -> f `go` xs
131 IO ( ( Either (P.ParseError Char P.Dec)
132 (S.Either [At SRC (Error_Compta SRC)] (CanonFile, Journal [Transaction]))
133 , Context_Read SRC [Transaction] )
134 , Context_Sym SRC SS )
135 x0 = readJournal @SS "./Hcompta/LCC/Journal/02.jnl" (:)
138 -- :: CF (P.ParsecT P.Dec Text m) a
139 :: ( m ~ S.StateT (Context_Read j) (S.StateT (Context_Sym cs is) IO)
141 , cs ~ Sym.TyConsts_of_Ifaces is
142 -- , e ~ P.ParseError Char P.Dec
144 => CF (P.ParsecT P.Dec Text m)
146 , Either (At (Sym.Error_Term Meta cs is))