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