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.Balance
10 , module Hcompta.LCC.Sym.Chart
11 -- , module Hcompta.LCC.Sym.Code
12 -- , module Hcompta.LCC.Sym.Compta
13 , module Hcompta.LCC.Sym.Date
14 , module Hcompta.LCC.Sym.FileSystem
15 , module Hcompta.LCC.Sym.Journal
16 , module Hcompta.LCC.Sym.LCC
17 , module Hcompta.LCC.Sym.Negable
18 , module Hcompta.LCC.Sym.Posting
19 , module Hcompta.LCC.Sym.Quantity
20 , module Hcompta.LCC.Sym.Subable
21 , module Hcompta.LCC.Sym.Sumable
22 , module Hcompta.LCC.Sym.Transaction
23 , module Hcompta.LCC.Sym.Unit
24 , module Hcompta.LCC.Sym.Writeable
25 , module Hcompta.LCC.Sym.Zeroable
26 , module Hcompta.LCC.Sym.Zipper
29 import Language.Symantic (type (++))
30 import qualified Language.Symantic as Sym
31 import qualified Language.Symantic.Lib as Sym
33 import Hcompta.LCC.Sym.Account
34 import Hcompta.LCC.Sym.Addable
35 import Hcompta.LCC.Sym.Amount
36 import Hcompta.LCC.Sym.Balance
37 import Hcompta.LCC.Sym.Chart
38 -- import Hcompta.LCC.Sym.Compta
39 -- import Hcompta.LCC.Sym.Code
40 import Hcompta.LCC.Sym.Date
41 import Hcompta.LCC.Sym.FileSystem
42 import Hcompta.LCC.Sym.Journal
43 import Hcompta.LCC.Sym.LCC
44 import Hcompta.LCC.Sym.Negable
45 import Hcompta.LCC.Sym.Posting
46 import Hcompta.LCC.Sym.Quantity
47 import Hcompta.LCC.Sym.Subable
48 import Hcompta.LCC.Sym.Sumable
49 import Hcompta.LCC.Sym.Transaction
50 import Hcompta.LCC.Sym.Writeable
51 import Hcompta.LCC.Sym.Unit
52 import Hcompta.LCC.Sym.Zeroable
53 import Hcompta.LCC.Sym.Zipper
55 import qualified Hcompta.LCC.Account as LCC
56 import qualified Hcompta.LCC.Amount as LCC
57 import qualified Hcompta.LCC.Balance as LCC
58 import qualified Hcompta.LCC.Chart as LCC
59 import qualified Hcompta.LCC.Compta as LCC
60 import qualified Hcompta.LCC.IO as LCC
61 import qualified Hcompta.LCC.Journal as LCC
62 import qualified Hcompta.LCC.Posting as LCC
63 import qualified Hcompta.LCC.Source as LCC
64 import qualified Hcompta.LCC.Transaction as LCC
65 import Hcompta.LCC.Write
66 import qualified Hcompta as H
68 import Control.Applicative (Applicative, Alternative)
69 import Control.Monad (Monad)
70 import Data.Bool (Bool)
71 import Data.Either (Either(..))
73 import Data.Foldable (Foldable)
74 import Data.Functor (Functor)
75 import Data.Map.Strict (Map)
76 import Data.Maybe (Maybe)
77 import Data.MonoTraversable (MonoFunctor, MonoFoldable)
78 import Data.Monoid (Monoid)
79 import Data.NonNull (NonNull)
82 import Data.Semigroup (Semigroup)
83 import Data.Sequences (SemiSequence, IsSequence)
84 import Data.Text (Text)
85 import Data.Traversable (Traversable)
86 import Data.TreeMap.Strict.Zipper (Zipper)
87 import Prelude (Integer)
89 import Text.Show (Show)
91 type SS = {-Proxy (LCC.Code SRC SS') ':-} SS'
92 type SRC = Sym.SrcTe LCC.SourcePath SS'
117 , Proxy (LCC.Journal LCC.SourceRead)
119 , Proxy (LCC.Posting LCC.SourceRead)
121 , Proxy (LCC.Transaction LCC.SourceRead)
137 , Proxy (LCC.LCC LCC.SourceRead)
149 = Error_App_not_applicable
150 | Error_App_type_mismatch (Sym.EType cs) (Sym.EType cs)
154 :: Sym.Inj_TyConst cs (->)
155 => Sym.ETermClosed cs is
156 -> Sym.ETermClosed cs is
157 -> Either (Error_App cs) (Sym.ETermClosed cs is)
158 app (Sym.ETermClosed ty_f (Sym.TermClosed te_f))
159 (Sym.ETermClosed ty_a (Sym.TermClosed te_a)) =
161 ty_fun Sym.:$ ty_arg Sym.:$ ty_res
162 | Just Refl <- Sym.kind_of ty_fun `Sym.eq_skind` (Sym.kind::Sym.SKind (Kind.Type -> Kind.Type -> Kind.Type))
163 , Just Refl <- ty_fun `Sym.eq_Type` Sym.ty @(->) ->
164 case ty_arg `Sym.eq_Type` ty_a of
165 Just Refl -> Right $ Sym.ETermClosed ty_res $ Sym.TermClosed $ te_f Sym..$ te_a
166 Nothing -> Left $ Error_App_type_mismatch (Sym.EType ty_arg) (Sym.EType ty_a)
167 _ -> Left $ Error_App_not_applicable
168 feed_args :: Sym.TermAVT src -> [Sym.TermAVT src] -> Sym.TermAVT src
169 feed_args te as = go te as
174 Right f' -> f' `go` as
175 Left _err -> f `go` xs
180 IO ( ( Either (P.ParseError Char P.Dec)
181 (S.Either [At SRC (Error_Compta SRC)] (CanonFile, Journal [Transaction]))
182 , Context_Read SRC [Transaction] )
183 , Context_Sym SRC SS )
184 x0 = readJournal @SS "./Hcompta/LCC/Journal/02.jnl" (:)
187 -- :: CF (P.ParsecT P.Dec Text m) a
188 :: ( m ~ S.StateT (Context_Read j) (S.StateT (Context_Sym cs is) IO)
190 , cs ~ Sym.TyConsts_of_Ifaces is
191 -- , e ~ P.ParseError Char P.Dec
193 => CF (P.ParsecT P.Dec Text m)
195 , Either (At (Sym.Error_Term Meta cs is))