Safe Haskell | Safe-Inferred |
---|
A Transaction consists of a TopLine (information common to all postings, such as the DateTime) and of at least two Postings. This data relationship is so important and useful that it is expressed in these modules. This module has its own functions and re-exports functions and types from other modules in this hierarchy. There are handy accessor functions for the records within each of the family types, but these are not exported due to name conflicts; if you want these simply import the necessary module (maybe qualified).
- data Family p c = Family p c c [c]
- data Child p c = Child c c [c] p
- data Siblings a = Siblings a a [a]
- mapChildrenA :: Applicative m => (a -> m b) -> Family p a -> m (Family p b)
- mapChildren :: (a -> b) -> Family p a -> Family p b
- mapParentA :: Applicative m => (a -> m b) -> Family a c -> m (Family b c)
- mapParent :: (a -> b) -> Family a c -> Family b c
- children :: Family p c -> Siblings (Child p c)
- orphans :: Family p c -> Siblings c
- adopt :: p -> Siblings c -> Family p c
- marryWith :: (p1 -> p2 -> p3) -> (c1 -> c2 -> c3) -> Family p1 c1 -> Family p2 c2 -> Family p3 c3
- marry :: Family p1 c1 -> Family p2 c2 -> Family (p1, p2) (c1, c2)
- divorceWith :: (p1 -> (p2, p3)) -> (c1 -> (c2, c3)) -> Family p1 c1 -> (Family p2 c2, Family p3 c3)
- divorce :: Family (p1, p2) (c1, c2) -> (Family p1 c1, Family p2 c2)
- filterChildren :: (a -> Bool) -> Family p a -> Maybe (Family p a)
- find :: (p -> c -> Bool) -> Family p c -> Maybe c
- collapse :: Siblings (NonEmpty a) -> Siblings a
Family types
A Family has one parent (ah, the anomie, sorry) and at least two children.
Family p c c [c] |
A Child has at least one sibling and a parent.
Child c c [c] p |
Describes the siblings of a family, but tells you nothing about the parent. There are always at least two Siblings.
Siblings a a [a] |
Mapping families
mapChildrenA :: Applicative m => (a -> m b) -> Family p a -> m (Family p b)Source
Maps over all children, in order starting with child 1, then child 2, then the children in the list from left to right.
mapChildren :: (a -> b) -> Family p a -> Family p bSource
Maps over all children.
mapParentA :: Applicative m => (a -> m b) -> Family a c -> m (Family b c)Source
Maps over the parent in an Applicative.
Functions to manipulate families
children :: Family p c -> Siblings (Child p c)Source
Gets a family's children. The Child type contains information on the parent, and each Child contains information on the other Siblings.
adopt :: p -> Siblings c -> Family p cSource
Unites a parent and some siblings into one family; the dual of orphans.
marryWith :: (p1 -> p2 -> p3) -> (c1 -> c2 -> c3) -> Family p1 c1 -> Family p2 c2 -> Family p3 c3Source
Marries two families into one. This function is rather cruel: if one family has more children than the other family, then the extra children are discarded. That is, all children must pair one-by-one.
marry :: Family p1 c1 -> Family p2 c2 -> Family (p1, p2) (c1, c2)Source
marryWith a tupling function.
divorceWith :: (p1 -> (p2, p3)) -> (c1 -> (c2, c3)) -> Family p1 c1 -> (Family p2 c2, Family p3 c3)Source
Splits up a family.
divorce :: Family (p1, p2) (c1, c2) -> (Family p1 c1, Family p2 c2)Source
divorceWith an untupling function.