ENH clean up types a bit
This commit is contained in:
parent
2946a8f9e2
commit
00346ff8ee
|
@ -280,6 +280,7 @@ let DatePat =
|
|||
|
||||
let TxOpts =
|
||||
{- Additional metadata to use when parsing a statement -}
|
||||
\(re : Type) ->
|
||||
{ Type =
|
||||
{ toDate :
|
||||
{-
|
||||
|
@ -312,7 +313,7 @@ let TxOpts =
|
|||
{- Format of the amount field. Must include three fields for the
|
||||
sign, numerator, and denominator of the amount.
|
||||
-}
|
||||
Text
|
||||
re
|
||||
}
|
||||
, default =
|
||||
{ toDate = "Date"
|
||||
|
@ -679,7 +680,10 @@ let Amount =
|
|||
-}
|
||||
\(w : Type) ->
|
||||
\(v : Type) ->
|
||||
{ Type =
|
||||
{ amtWhen : w, amtValue : v, amtDesc : Text, amtPriority : Integer }
|
||||
, default.amtPriority = +0
|
||||
}
|
||||
|
||||
let TransferType =
|
||||
{-
|
||||
|
@ -711,7 +715,7 @@ let Transfer =
|
|||
{ transFrom : a
|
||||
, transTo : a
|
||||
, transCurrency : c
|
||||
, transAmounts : List (Amount w v)
|
||||
, transAmounts : List (Amount w v).Type
|
||||
}
|
||||
|
||||
let TaggedAcnt =
|
||||
|
@ -748,7 +752,7 @@ let Statement =
|
|||
file delimiter as a numeric char, usually either tab (9) or comma (44)
|
||||
-}
|
||||
: Natural
|
||||
, stmtTxOpts : TxOpts.Type
|
||||
, stmtTxOpts : (TxOpts Text).Type
|
||||
, stmtSkipLines
|
||||
{-
|
||||
how many lines to skip before parsing statement
|
||||
|
@ -771,7 +775,7 @@ let Allocation =
|
|||
\(w : Type) ->
|
||||
\(v : Type) ->
|
||||
{ alloTo : TaggedAcnt.Type
|
||||
, alloAmts : List (Amount w v)
|
||||
, alloAmts : List (Amount w v).Type
|
||||
, alloCur :
|
||||
{-TODO allow exchanges here-}
|
||||
CurID
|
||||
|
|
|
@ -9,7 +9,7 @@ let nullEntry =
|
|||
\(v : T.EntryNumGetter) ->
|
||||
T.FromEntryGetter::{ eAcnt = a, eValue = v }
|
||||
|
||||
let nullOpts = T.TxOpts::{=}
|
||||
let nullOpts = (T.TxOpts Text)::{=}
|
||||
|
||||
let nullVal = T.ValMatcher::{=}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import Language.Haskell.TH.Syntax (Lift)
|
|||
import RIO
|
||||
import qualified RIO.Map as M
|
||||
import qualified RIO.Text as T
|
||||
-- import RIO.Time
|
||||
import Text.Regex.TDFA
|
||||
|
||||
makeHaskellTypesWith
|
||||
|
@ -49,12 +48,18 @@ makeHaskellTypesWith
|
|||
, SingleConstructor "ModPat" "ModPat" "(./dhall/Types.dhall).ModPat.Type"
|
||||
, SingleConstructor "CronPat" "CronPat" "(./dhall/Types.dhall).CronPat.Type"
|
||||
, SingleConstructor "ValMatcher" "ValMatcher" "(./dhall/Types.dhall).ValMatcher.Type"
|
||||
, SingleConstructor "Amount" "Amount" "(./dhall/Types.dhall).Amount"
|
||||
, SingleConstructor
|
||||
"Amount"
|
||||
"Amount"
|
||||
"\\(w : Type) -> \\(v : Type) -> ((./dhall/Types.dhall).Amount w v).Type"
|
||||
, SingleConstructor
|
||||
"TxOpts"
|
||||
"TxOpts"
|
||||
"\\(re : Type) -> ((./dhall/Types.dhall).TxOpts re).Type"
|
||||
, SingleConstructor "AcntSet" "AcntSet" "(./dhall/Types.dhall).AcntSet.Type"
|
||||
, SingleConstructor "TransferMatcher" "TransferMatcher" "(./dhall/Types.dhall).TransferMatcher.Type"
|
||||
, SingleConstructor "ShadowTransfer" "ShadowTransfer" "(./dhall/Types.dhall).ShadowTransfer"
|
||||
, -- , SingleConstructor "Income" "Income" "(./dhall/Types.dhall).Income.Type"
|
||||
SingleConstructor "Field" "Field" "(./dhall/Types.dhall).Field"
|
||||
, SingleConstructor "Field" "Field" "(./dhall/Types.dhall).Field"
|
||||
, SingleConstructor "Entry" "Entry" "(./dhall/Types.dhall).Entry"
|
||||
, SingleConstructor "PretaxValue" "PretaxValue" "(./dhall/Types.dhall).PretaxValue"
|
||||
, SingleConstructor "TaxBracket" "TaxBracket" "(./dhall/Types.dhall).TaxBracket"
|
||||
|
@ -64,11 +69,6 @@ makeHaskellTypesWith
|
|||
, SingleConstructor "TransferValue" "TransferValue" "(./dhall/Types.dhall).TransferValue.Type"
|
||||
, SingleConstructor "Period" "Period" "(./dhall/Types.dhall).Period"
|
||||
, SingleConstructor "HourlyPeriod" "HourlyPeriod" "(./dhall/Types.dhall).HourlyPeriod"
|
||||
-- , SingleConstructor "ToTx" "ToTx" "(./dhall/Types.dhall).ToTx"
|
||||
-- , SingleConstructor "FieldMatcher" "FieldMatcher" "(./dhall/Types.dhall).FieldMatcher_"
|
||||
-- , SingleConstructor "Match" "Match" "(./dhall/Types.dhall).Match_"
|
||||
-- , SingleConstructor "Budget" "Budget" "(./dhall/Types.dhall).Budget"
|
||||
-- SingleConstructor "Transfer" "Transfer" "(./dhall/Types.dhall).Transfer"
|
||||
]
|
||||
|
||||
deriveProduct
|
||||
|
@ -443,15 +443,15 @@ deriving instance (Hashable a, Hashable v, Hashable t) => Hashable (Entry a v t)
|
|||
|
||||
deriving instance (Eq a, Eq v, Eq t) => Eq (Entry a v t)
|
||||
|
||||
data TxOpts re = TxOpts
|
||||
{ toDate :: !T.Text
|
||||
, toAmount :: !T.Text
|
||||
, toDesc :: !T.Text
|
||||
, toOther :: ![T.Text]
|
||||
, toDateFmt :: !T.Text
|
||||
, toAmountFmt :: !re
|
||||
}
|
||||
deriving (Eq, Generic, Hashable, Show, FromDhall)
|
||||
deriving instance Eq a => Eq (TxOpts a)
|
||||
|
||||
deriving instance Generic (TxOpts a)
|
||||
|
||||
deriving instance Hashable a => Hashable (TxOpts a)
|
||||
|
||||
deriving instance FromDhall a => FromDhall (TxOpts a)
|
||||
|
||||
deriving instance Show a => Show (TxOpts a)
|
||||
|
||||
data Statement = Statement
|
||||
{ stmtPaths :: ![FilePath]
|
||||
|
|
Loading…
Reference in New Issue