packages feed

exchangealgebra 0.6.0.1 → 0.6.1.0

raw patch · 19 files changed

+415/−13 lines, 19 files

Files

ChangeLog.md view
@@ -1,5 +1,22 @@ # Changelog for ExchangeAlgebra +## 0.6.1.0 - 2026-11-20++### Added++- `Wild a` extends a coordinate type with the wildcard `Wild` and represents+  ordinary coordinates as `Exactly a`. It provides `Element` and `BaseClass`+  instances when the payload has `Ord`, `Show`, `Hashable`, and `Typeable`+  instances, along with `Eq`, `Ord`, `Show`, `Generic`, `NFData`, `Hashable`, and+  `Binary` support. Use `Wild TimeOfDay` or `Wild Day` to record and query+  00:00 or 1858-11-17 as an ordinary coordinate. The existing `Element`+  instances for `TimeOfDay` and `Day` still use those values as their wildcards.+- The following built-in bases now provide `ExBaseClass` instances:++  - `HatBase (AccountTitles, Wild Day)`+  - `HatBase (AccountTitles, Name, CountUnit, Subject, Wild Day)`+  - `HatBase (AccountTitles, Name, CountUnit, Subject, Wild Day, Wild TimeOfDay)`+ ## 0.6.0.1 - 2026-11-09  ### Fixed
README.md view
@@ -21,7 +21,7 @@ ```yaml # stack.yaml extra-deps:-  - exchangealgebra-0.6.0.0+  - exchangealgebra-0.6.0.1 ```  ```yaml
exchangealgebra.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           exchangealgebra-version:        0.6.0.1+version:        0.6.1.0 synopsis:       Exchange Algebra for bookkeeping and economic simulation description:    Exchange Algebra is an algebraic description of bookkeeping developed by Hiroshi Deguchi. This package represents bookkeeping entries as elements of a redundant algebra, where increases and decreases are expressed by Hat and Not bases rather than by sign. It provides journals with notes, accounting operations such as closing, transfers, trial balances, and financial statements, CSV input and output, and a state-space framework for economic simulation. See the README for a guide and the changelog for migration notes. category:       Accounting, Finance, Math
src/ExchangeAlgebra.hs view
@@ -105,6 +105,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , Hashable(..)     , Generic     , Nearly(..)
src/ExchangeAlgebra/Accounting/Exchange.hs view
@@ -79,6 +79,7 @@ import ExchangeAlgebra.Algebra.Element.Representation ( Name                                                       , Subject                                                       , CountUnit+                                                      , Wild                                                       , matchesQuery                                                       ) import ExchangeAlgebra.Algebra.Core.Representation ( Alg(..)@@ -257,6 +258,27 @@ -- ** 6-element bases -- | Basic BaseClass with 6 elements instance ExBaseClass (HatBase (AccountTitles, Name, CountUnit, Subject, Day, TimeOfDay)) where+    getAccountTitle (_:< (a, _, _, _, _, _))   = a+    setAccountTitle (h:< (_, n, c, s, d, t)) b = h:< (b, n, c, s, d, t)++-- ** Bases with wildcard-extended dates and times+--+-- The bases above use the 'Element' instances of 'Day' and t'TimeOfDay', whose+-- wildcards are reserved dates and times (1858-11-17 and midnight). The+-- following bases use t'Wild' instead, so every date and time of day remains+-- an ordinary coordinate.+--+-- @since 0.6.1.0++instance ExBaseClass (HatBase (AccountTitles, Wild Day)) where+    getAccountTitle (_:< (a, _))   = a+    setAccountTitle (h:< (_, d)) b = h:< (b, d)++instance ExBaseClass (HatBase (AccountTitles, Name, CountUnit, Subject, Wild Day)) where+    getAccountTitle (_:< (a, _, _, _, _))   = a+    setAccountTitle (h:< (_, n, c, s, d)) b = h:< (b, n, c, s, d)++instance ExBaseClass (HatBase (AccountTitles, Name, CountUnit, Subject, Wild Day, Wild TimeOfDay)) where     getAccountTitle (_:< (a, _, _, _, _, _))   = a     setAccountTitle (h:< (_, n, c, s, d, t)) b = h:< (b, n, c, s, d, t) 
src/ExchangeAlgebra/Algebra.hs view
@@ -39,6 +39,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , Hashable(..)     , Generic     , Nearly(..)
src/ExchangeAlgebra/Algebra/Base.hs view
@@ -41,6 +41,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , Hashable(..)     , Generic     ) where@@ -62,6 +63,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , Hashable(..)     , Generic     )
src/ExchangeAlgebra/Algebra/Base/Representation.hs view
@@ -16,6 +16,7 @@ import GHC.Stack (HasCallStack, callStack, prettyCallStack) import qualified Data.Binary as Binary import Control.DeepSeq (NFData(..))+import Data.Typeable (Typeable)  -- | Raise an error with the current call stack appended. customError :: HasCallStack => String -> a@@ -287,3 +288,8 @@  -- *** TimeOfDay only (redundant algebra base) instance BaseClass TimeOfDay where++-- *** A coordinate extended with a wildcard (redundant algebra base)+--+-- @since 0.6.1.0+instance (Ord a, Show a, Hashable a, Typeable a) => BaseClass (Wild a) where
src/ExchangeAlgebra/Algebra/Element.hs view
@@ -19,6 +19,17 @@   wildcard = CompanyWildcard @ +Use t'Wild' for a coordinate type whose values all have meaning, such as+@Day@, @TimeOfDay@, or a custom identifier. Wrap ordinary coordinates in+'Exactly' and use the v'Wild' constructor as the wildcard. The underlying type+can be used without defining its own 'Element' instance.++>>> import Data.Time (TimeOfDay, midnight)+>>> matchesQuery (Exactly midnight) (Wild :: Wild TimeOfDay)+False+>>> matchesQuery Wild (Exactly midnight)+True+ == Import guidance  Import 'Element' and its associated symbols from@@ -27,7 +38,7 @@ -} module ExchangeAlgebra.Algebra.Element     ( Element(..), AxisKey(..), axisIsWildcard, AxisDecompose(..), (.#)-    , Name, Subject, CountUnit(..), matchesQuery, Hashable(..), Generic+    , Name, Subject, CountUnit(..), Wild(..), matchesQuery, Hashable(..), Generic     ) where  import ExchangeAlgebra.Algebra.Element.Representation
src/ExchangeAlgebra/Algebra/Element/Representation.hs view
@@ -14,6 +14,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , matchesQuery     , Hashable(..)     , Generic@@ -252,11 +253,60 @@ instance Hashable Day where   hashWithSalt salt day = hashWithSalt salt (toModifiedJulianDay day) +-- | The wildcard is 'Time.midnight', so a coordinate recorded at 00:00 is+-- indistinguishable from "no time of day". Use @Wild TimeOfDay@ for an+-- axis on which midnight is a meaningful time. instance Element TimeOfDay where     wildcard = Time.midnight +-- | The wildcard is @'ModifiedJulianDay' 0@ (1858-11-17), so that date is+-- indistinguishable from "no date". Use @Wild Day@ for an axis on which+-- every date is meaningful. instance Element Day where     wildcard =  ModifiedJulianDay 0++------------------------------------------------------------------+-- | A coordinate type extended with a wildcard from outside the type.+--+-- Use it for an axis whose underlying type has no value to spare for the+-- wildcard, such as 'Day' or t'TimeOfDay': every date and every time of day is+-- a meaningful coordinate, so @'Exactly' 'Time.midnight'@ remains an ordinary+-- time and only v'Wild' is the wildcard.+--+-- * In a ledger entry, v'Wild' records that the axis does not apply+--   (for example, a transaction recorded without a time of day).+-- * In a query or a transfer source, v'Wild' matches any stored coordinate,+--   including a stored v'Wild'.+-- * In a transfer target, v'Wild' keeps the source coordinate.+--+-- @'Exactly' x@ matches only @'Exactly' x@ ('matchesQuery'). The derived+-- order places v'Wild' before every @'Exactly' x@ and orders 'Exactly'+-- values by the order of @a@.+--+-- The underlying type need not be an 'Element'. If it is, its own wildcard+-- becomes an ordinary coordinate once wrapped: @'Exactly' ""@ on a+-- @Wild Text@ axis is the empty text, not the wildcard.+--+-- @since 0.6.1.0+data Wild a+    = Wild        -- ^ The wildcard of the axis.+    | Exactly a   -- ^ An ordinary coordinate.+    deriving (Eq, Ord, Show, Generic)++instance NFData a => NFData (Wild a)++instance Hashable a => Hashable (Wild a)++instance Binary.Binary a => Binary.Binary (Wild a)++instance (Ord a, Show a, Hashable a, Typeable a) => Element (Wild a) where++    {-# INLINE wildcard #-}+    wildcard = Wild++    {-# INLINE isWildcard #-}+    isWildcard Wild = True+    isWildcard _    = False  instance (Element a ,Element b)     => Element (a, b) where
src/ExchangeAlgebra/Algebra/Internal.hs view
@@ -57,6 +57,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , Hashable(..)     , Generic     , Nearly(..)
src/ExchangeAlgebra/Journal.hs view
@@ -45,6 +45,7 @@     , Name     , Subject     , CountUnit(..)+    , Wild(..)     , Hashable(..)     , Generic     , HatVal(..)
test/Algebra/ProjWildcardSpec.hs view
@@ -7,6 +7,13 @@ -- element or a 'Liner'). module Algebra.ProjWildcardSpec (runTests) where +import qualified Data.Binary as Binary+import           Data.Time ( Day(ModifiedJulianDay)+                           , TimeOfDay(..)+                           , fromGregorian+                           , midnight+                           )+import           Data.Typeable (Typeable) import ExchangeAlgebra.Accounting.Account import ExchangeAlgebra.Accounting.Exchange import           Control.Monad (unless)@@ -17,7 +24,11 @@ import           Test.QuickCheck hiding (label) import           ExchangeAlgebra.Algebra hiding (map, filter) import qualified ExchangeAlgebra.Algebra as Algebra-import           ExchangeAlgebra.Algebra.Transfer.Rule (collapseEntries)+import           ExchangeAlgebra.Algebra.Element (matchesQuery)+import qualified ExchangeAlgebra.Algebra.Transfer as Transfer+import           ExchangeAlgebra.Algebra.Value (MoneyDecimal)+import qualified ExchangeAlgebra.Journal as Journal+import           Support (assertEqual)  -- | Account and unit coordinates; either axis may hold a ledger wildcard. type TestBase = HatBase (AccountTitles, CountUnit)@@ -221,14 +232,14 @@     nestedCollapsed = foldEntries         (\result value (side :< ((first, second), third)) ->             (value, side, (first, second, third)) : result) []-        (collapseEntries [nestedQuery] (const (("a", "b"), "d")) nestedLedger)+        (Transfer.collapseEntries [nestedQuery] (const (("a", "b"), "d")) nestedLedger)     flatCollapsed :: [(Double, Hat, (Text, Text, Text))]     flatCollapsed = foldEntries         (\result value (side :< coordinates) -> (value, side, coordinates) : result) []-        (collapseEntries [flatQuery] (const ("a", "b", "d")) flatLedger)+        (Transfer.collapseEntries [flatQuery] (const ("a", "b", "d")) flatLedger)  -- | The reported inner-only wildcard selects gross 13 and net 7, and--- collapseEntries adds reversal and replacement postings with total norm 26.+-- 'Transfer.collapseEntries' adds reversal and replacement postings with total norm 26. testNestedWildcard :: IO () testNestedWildcard = do     let ledger = 10 .@ Not :< (("a", "b"), "c")@@ -239,10 +250,270 @@     assertTest "nested wildcard: reported projection and collapse values"         (norm (proj [query] ledger) == 13             && projNetNorm [query] ledger == 7-            && norm (collapseEntries [query] (const (("a", "b"), "d")) ledger) == 26)+            && norm (Transfer.collapseEntries [query] (const (("a", "b"), "d")) ledger) == 26)     assertTest "nested wildcard: reported case agrees with flat coordinates"         (propNestedFlattening ("a", "", "c") (10, 3, 2)) +-- | A fixture identifier with no Element instance and deliberately colliding hashes.+newtype FixtureId = FixtureId Int+    deriving (Eq, Ord, Show)++instance Hashable FixtureId where+    hashWithSalt salt _ = salt++instance Binary.Binary FixtureId where+    put (FixtureId number) = Binary.put number+    get = FixtureId <$> Binary.get++-- | Compare exact coordinates, sides, and amounts independently of posting order.+observeWild :: forall coordinates. (BaseClass coordinates, AxisDecompose coordinates)+            => Alg MoneyDecimal (HatBase coordinates)+            -> [(Hat, coordinates, MoneyDecimal)]+observeWild = List.sort . foldEntries collect []+  where+    collect :: [(Hat, coordinates, MoneyDecimal)]+            -> MoneyDecimal+            -> HatBase coordinates+            -> [(Hat, coordinates, MoneyDecimal)]+    collect postings amount (side :< coordinates) = (side, coordinates, amount) : postings++-- | Match one coordinate without using the library's matching implementation.+matchesAxis :: Element coordinate => coordinate -> coordinate -> Bool+matchesAxis query entry = isWildcard query || query == entry++-- | Check every ordered pair in an ascending list of concrete coordinates plus Wild.+testWildAxis :: forall coordinate.+                (Ord coordinate, Show coordinate, Hashable coordinate, Typeable coordinate)+             => String+             -> [coordinate]+             -> IO ()+testWildAxis axis concrete = do+    assertEqual (axis ++ " matchesQuery is one-way")+        [query == Wild || query == entry | (query, entry) <- pairs]+        [matchesQuery query entry | (query, entry) <- pairs]+    assertEqual (axis ++ " .== is symmetric")+        [query == Wild || entry == Wild || query == entry | (query, entry) <- pairs]+        [query .== entry | (query, entry) <- pairs]+    assertEqual (axis ++ " compareElement treats Wild as EQ in either position")+        [wildcardOrder query entry | (query, entry) <- pairs]+        [compareElement query entry | (query, entry) <- pairs]+    assertEqual (axis ++ " compare orders Wild first and agrees with Eq")+        [(compare left right, left == right) | (left, right) <- indexPairs]+        [(compare left right, left == right) | (left, right) <- pairs]+  where+    coordinates :: [Wild coordinate]+    coordinates = Wild : fmap Exactly concrete++    pairs :: [(Wild coordinate, Wild coordinate)]+    pairs       = [(query, entry) | query <- coordinates, entry <- coordinates]++    indices :: [Int]+    indices = take (length coordinates) [0 ..]++    indexPairs :: [(Int, Int)]+    indexPairs = [(left, right) | left <- indices, right <- indices]++    wildcardOrder :: Ord payload => Wild payload -> Wild payload -> Ordering+    wildcardOrder Wild _ = EQ+    wildcardOrder _ Wild = EQ+    wildcardOrder left right = compare left right++-- | Account, time, and identifier coordinates shared by both projection shapes.+type WildCoordinates = (AccountTitles, Wild TimeOfDay, Wild Text)++-- | Flat tuples expose each axis key. A nested tuple stays one key at its outer position.+testWildAxisKeys :: IO ()+testWildAxisKeys = do+    assertTest "Wild flat tuple has one wildcard at the time axis" $+        haveWildcard flat && not (haveWildcard (Cash, time, identifier))+    assertTest "Wild nested tuple has an inner wildcard" $+        haveWildcard nested && not (haveWildcard (Cash, (time, identifier)))+    assertTest "Wild flat tuple exposes three axis keys in coordinate order" $+        toAxisKeys flat == [AxisKey Cash, AxisKey noTime, AxisKey identifier]+    assertTest "Wild nested tuple exposes two outer keys with the pair in position two" $+        toAxisKeys nested == [AxisKey Cash, AxisKey (noTime, identifier)]+  where+    noTime :: Wild TimeOfDay+    noTime = Wild++    time :: Wild TimeOfDay+    time = Exactly midnight++    identifier :: Wild Text+    identifier = Exactly ""++    flat :: WildCoordinates+    flat = (Cash, noTime, identifier)++    nested :: (AccountTitles, (Wild TimeOfDay, Wild Text))+    nested = (Cash, (noTime, identifier))++-- | Exercise single and indexed projections against the same per-axis oracle.+testWildProjection :: forall coordinates. (BaseClass coordinates, AxisDecompose coordinates)+                   => String+                   -> (WildCoordinates -> coordinates)+                   -> IO ()+testWildProjection shape pack = mapM_ checkQueries querySets+  where+    entries :: [(MoneyDecimal, Hat, WildCoordinates)]+    entries =+        [ (10, Not, (Cash, Exactly midnight, Exactly ""))+        , ( 4, Hat, (Cash, Exactly midnight, Exactly ""))+        , (20, Not, (Cash, Wild,             Exactly ""))+        , (30, Not, (Cash, Exactly midnight, Wild))+        , (40, Not, (Sales, Exactly midnight, Exactly ""))+        ]++    querySets :: [[(Hat, WildCoordinates)]]+    querySets =+        [ [(HatNot, (Cash, Exactly midnight, Exactly ""))]+        , [(HatNot, (Cash, Wild,             Exactly ""))]+        , [(Not,    (Cash, Exactly midnight, Wild))]+        , [(HatNot, (Cash, Wild, Exactly "")), (Not, (Cash, Exactly midnight, Wild))]+        ]++    matches :: (Hat, WildCoordinates) -> (MoneyDecimal, Hat, WildCoordinates) -> Bool+    matches (querySide, (queryTitle, queryTime, queryId))+            (_, entrySide, (entryTitle, entryTime, entryId)) =+        matchesAxis querySide entrySide+            && matchesAxis queryTitle entryTitle+            && matchesAxis queryTime entryTime+            && matchesAxis queryId entryId++    posting :: (MoneyDecimal, Hat, WildCoordinates) -> Alg MoneyDecimal (HatBase coordinates)+    posting (amount, side, entry) = amount .@ side :< pack entry++    ledger :: Alg MoneyDecimal (HatBase coordinates)+    ledger = fromList (fmap posting entries)++    checkQueries :: [(Hat, WildCoordinates)] -> IO ()+    checkQueries patterns = do+        let queries  = [side :< pack query | (side, query) <- patterns]+            selected = fromList [posting entry | entry <- entries, selects entry]+            context  = "Wild " ++ shape ++ " " ++ show patterns+            note     = "receipts" :: Text+            journal  = Journal.projWithBase queries (ledger Journal..| note)+            singles  = fmap posting entries+            selects :: (MoneyDecimal, Hat, WildCoordinates) -> Bool+            selects entry = any (`matches` entry) patterns+        assertEqual (context ++ " single-posting proj")+            [observeWild (fromList [posting entry | selects entry]) | entry <- entries]+            [observeWild (proj queries single) | single <- singles]+        assertEqual (context ++ " single-posting projNetNorm")+            [norm (fromList [posting entry | selects entry]) | entry <- entries]+            [projNetNorm queries single | single <- singles]+        assertEqual (context ++ " indexed proj") (observeWild selected)+            (observeWild (proj queries ledger))+        assertEqual (context ++ " indexed projNetNorm") (norm (bar selected))+            (projNetNorm queries ledger)+        assertEqual (context ++ " journal base projection")+            (observeWild selected)+            (observeWild (Journal.toAlg (Journal.projWithNote [note] journal)))++-- | Check source matching and target retention with both stored time coordinates.+testWildTransfer :: IO ()+testWildTransfer = do+    assertTest "Wild concrete transfer source skips the stored Wild" $+        agrees (Exactly midnight) (4 .@ Hat :< (Cash, Exactly midnight)+                                .+ 4 .@ Not :< (Deposits, Exactly midnight))+    assertTest "Wild transfer target retains both stored time coordinates" $+        agrees Wild (7 .@ Hat :< (Cash, Wild)+                  .+ 7 .@ Not :< (Deposits, Wild)+                  .+ 4 .@ Hat :< (Cash, Exactly midnight)+                  .+ 4 .@ Not :< (Deposits, Exactly midnight))+  where+    ledger :: Alg MoneyDecimal (HatBase (AccountTitles, Wild TimeOfDay))+    ledger = 7 .@ Not :< (Cash, Wild)+          .+ 4 .@ Not :< (Cash, Exactly midnight)++    agrees :: Wild TimeOfDay -> Alg MoneyDecimal (HatBase (AccountTitles, Wild TimeOfDay)) -> Bool+    agrees source expected =+        case Transfer.mkTransferRules [rule] of+            Left _      -> False+            Right rules -> case Transfer.transferEntries rules ledger of+                Left _         -> False+                Right postings -> observeWild postings == observeWild expected+      where+        rule = Transfer.TransferRule (Not :< (Cash, source)) (Not :< (Deposits, Wild))+            Transfer.Relabel++-- | Replacing an account title preserves the Hat/Not side and every other coordinate.+testWildAccountTitles :: IO ()+testWildAccountTitles = do+    assertEqual "Wild Day: setAccountTitle preserves the day and side"+        (Hat :< (Deposits, epoch)) (setAccountTitle (Hat :< (Cash, epoch)) Deposits)+    assertEqual "Wild Day: setAccountTitle preserves the five-axis base"+        (Not :< (Deposits, item, Yen, subject, noDay))+        (setAccountTitle (Not :< (Cash, item, Yen, subject, noDay)) Deposits)+    assertEqual "Wild Day/TimeOfDay: setAccountTitle preserves the six-axis base"+        (Hat :< (Deposits, item, Yen, subject, epoch, Exactly midnight))+        (setAccountTitle (Hat :< (Cash, item, Yen, subject, epoch, Exactly midnight)) Deposits)+  where+    epoch = Exactly (ModifiedJulianDay 0)+    noDay = Wild :: Wild Day+    item = "notebook" :: Name+    subject = "stock" :: Subject++-- | Wrapped identifiers retain equality, serialization, and indexed lookup under collision.+testWildPayload :: IO ()+testWildPayload = do+    testWildAxis "Wild FixtureId" [FixtureId 1, FixtureId 2]+    assertTest "Wild Text treats empty text as an ordinary coordinate" $+        not (isWildcard empty) && not (haveWildcard empty)+            && matchesQuery empty empty && not (matchesQuery empty Wild)+    quickProperty "Wild equal coordinates hash equally at every salt" $+        forAll arbitrary $ \salt ->+            let pairs = [(Wild, Wild), (Exactly (FixtureId 1), first)]+            in all (\(left, right) -> hashWithSalt salt left == hashWithSalt salt right) pairs+    assertEqual "Wild Binary round trips both constructors"+        [Wild, first, second] (fmap (Binary.decode . Binary.encode) [Wild, first, second])+    assertTest "Wild index keys collide at the same salt" $+        firstKey /= secondKey && hashWithSalt 7 firstKey == hashWithSalt 7 secondKey+    let ledger = 7 .@ Not :< first .+ 9 .@ Not :< second+            :: Alg MoneyDecimal (HatBase (Wild FixtureId))+    assertEqual "Wild index retrieves the first colliding key" 7+        (norm (proj [Not :< first] ledger))+    assertEqual "Wild index retrieves the second colliding key" 9+        (norm (proj [Not :< second] ledger))+  where+    empty = Exactly "" :: Wild Text+    first = Exactly (FixtureId 1)+    second = Exactly (FixtureId 2)+    firstKey = AxisKey first+    secondKey = AxisKey second++-- | Midnight stays concrete on the wrapped axis and remains a wildcard on the legacy axis.+testWildCalendarRegression :: IO ()+testWildCalendarRegression = do+    assertEqual "Wild TimeOfDay: midnight selects only the midnight posting" 100+        (norm (proj [Not :< (Cash, Exactly midnight)] receipts))+    assertEqual "Wild TimeOfDay: Wild selects all three postings" 600+        (norm (proj [Not :< (Cash, Wild)] receipts))+    assertEqual "legacy TimeOfDay: midnight selects all three postings" 600+        (norm (proj [Not :< (Cash, midnight)] receiptsOld))+    assertEqual "Wild Day: 1858-11-17 selects only that day's posting" 500+        (norm (proj [Not :< (Cash, Exactly (ModifiedJulianDay 0))] dated))+    assertEqual "Wild Day: sale totals 500 on both debit and credit" (500, 500)+        (norm (decL sale), norm (decR sale))+  where+    receipts :: Alg MoneyDecimal (HatBase (AccountTitles, Wild TimeOfDay))+    receipts = 100 .@ Not :< (Cash, Exactly midnight)+            .+ 200 .@ Not :< (Cash, Exactly (TimeOfDay 9 0 0))+            .+ 300 .@ Not :< (Cash, Wild)++    receiptsOld :: Alg MoneyDecimal (HatBase (AccountTitles, TimeOfDay))+    receiptsOld = 100 .@ Not :< (Cash, midnight)+               .+ 200 .@ Not :< (Cash, TimeOfDay 9 0 0)+               .+ 300 .@ Not :< (Cash, midnight)++    sale :: Alg MoneyDecimal (HatBase (AccountTitles, Wild Day))+    sale = 500 .@ Not :< (Cash,  Exactly (fromGregorian 2026 1 10))+        .+ 500 .@ Not :< (Sales, Exactly (fromGregorian 2026 1 10))++    dated :: Alg MoneyDecimal (HatBase (AccountTitles, Wild Day))+    dated = sale .+ 500 .@ Not :< (Cash, Exactly (ModifiedJulianDay 0))+                 .+ 300 .@ Not :< (Cash, Wild)+ runTests :: IO () runTests = do     testReportedTable@@ -264,3 +535,12 @@         (forAll genProjCase propNetNorm)     quickProperty "proj: concrete ledgers keep the old symmetric result"         (forAll genConcreteCase propConcreteRegression)+    testWildAxis "Wild TimeOfDay" [midnight, TimeOfDay 9 0 0]+    testWildAxis "Wild Day" [ModifiedJulianDay (-1), ModifiedJulianDay 0, ModifiedJulianDay 1]+    testWildAxisKeys+    testWildProjection "flat tuple" id+    testWildProjection "nested tuple" (\(title, time, identifier) -> (title, (time, identifier)))+    testWildTransfer+    testWildAccountTitles+    testWildPayload+    testWildCalendarRegression
test/fixtures/export-surface-p2/ExchangeAlgebra.Algebra.Base.txt view
@@ -17,6 +17,7 @@ Dollar Element Euro+Exactly Generic Hashable Hat@@ -26,6 +27,7 @@ Name Not Subject+Wild Yen _base _hat
test/fixtures/export-surface-p2/ExchangeAlgebra.Algebra.Internal.txt view
@@ -27,6 +27,7 @@ Dollar Element Euro+Exactly Generic Hashable Hat@@ -42,6 +43,7 @@ Redundant Single Subject+Wild Yen Zero _allBpIds
test/fixtures/export-surface-p2/ExchangeAlgebra.Algebra.txt view
@@ -27,6 +27,7 @@ Dollar Element Euro+Exactly Generic Hashable Hat@@ -46,6 +47,7 @@ ToMultipleOf Tolerance ValueError+Wild Yen Zero _base
test/fixtures/export-surface-p2/ExchangeAlgebra.Journal.txt view
@@ -26,6 +26,7 @@ Dollar Element Euro+Exactly Generic Hashable Hat@@ -41,6 +42,7 @@ NoteAxisPosting Redundant Subject+Wild Yen Zero _base
test/fixtures/export-surface-p2/ExchangeAlgebra.txt view
@@ -156,6 +156,7 @@ EquitySection Euro ExBaseClass+Exactly Exchange ExpenseSection ExplainedTemporaryBalance@@ -455,6 +456,7 @@ WageEarned WageExpenditure WelfareExpenses+Wild WildcardPosting WildcardStatementBase WildcardTrialBalanceAccount
test/fixtures/export-surface-p2/counts.tsv view
@@ -5,11 +5,11 @@ ExchangeAlgebra.Algebra.Base.Account.Registry	23 ExchangeAlgebra.Algebra.Base.Account.Types	46 ExchangeAlgebra.Algebra.Base.Element	277-ExchangeAlgebra.Algebra.Base	54-ExchangeAlgebra.Algebra.Internal	127+ExchangeAlgebra.Algebra.Base	56+ExchangeAlgebra.Algebra.Internal	129 ExchangeAlgebra.Algebra.Transfer.Rule	36 ExchangeAlgebra.Algebra.Transfer	18-ExchangeAlgebra.Algebra	128+ExchangeAlgebra.Algebra	130 ExchangeAlgebra.Assist.Descriptions	1 ExchangeAlgebra.Assist	16 ExchangeAlgebra.Bookkeeping	19@@ -20,7 +20,7 @@ ExchangeAlgebra.IO.Input.Admission	19 ExchangeAlgebra.Journal.Transfer.Rule	13 ExchangeAlgebra.Journal.Transfer	12-ExchangeAlgebra.Journal	113+ExchangeAlgebra.Journal	115 ExchangeAlgebra.Optimize.Annealing	10 ExchangeAlgebra.Optimize.GA	14 ExchangeAlgebra.Optimize	8@@ -43,4 +43,4 @@ ExchangeAlgebra.TrialBalance.Balance	12 ExchangeAlgebra.TrialBalance.Validation	35 ExchangeAlgebra.Value	13-ExchangeAlgebra	675+ExchangeAlgebra	677