Copyright | Kadzuya Okamoto 2018 |
---|---|
License | MIT |
Stability | experimental |
Portability | unknown |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Monadic representation of transactions.
Synopsis
- action :: a -> Transaction a
- reduce :: (b -> a -> b) -> b -> Transaction a -> b
- toList :: Transaction a -> [a]
- tMap :: (a -> b) -> Transaction a -> Transaction b
- tFilter :: (a -> Bool) -> Transaction a -> Transaction a
- tFilterMap :: (a -> Maybe b) -> Transaction a -> Transaction b
- type Transaction a = TransactionM a ()
- data TransactionM a x
Constructors
action :: a -> Transaction a Source #
>>>
:{
toList $ do action 4 action 5 action 6 :} [4,5,6]
>>>
:{
toList $ filter even $ do action 4 action 5 action 6 :} [4,6]
Converters
reduce :: (b -> a -> b) -> b -> Transaction a -> b Source #
An alias of foldl
for convenience.
toList :: Transaction a -> [a] Source #
tMap :: (a -> b) -> Transaction a -> Transaction b Source #
An alias of first
for convenience.
>>>
:{
toList $ do action 4 tMap (+1) $ do action 5 action 6 action 7 :} [4,6,7,7]
tFilter :: (a -> Bool) -> Transaction a -> Transaction a Source #
tFilterMap :: (a -> Maybe b) -> Transaction a -> Transaction b Source #
Deprecated: This will be removed in a future release.
>>>
:{
toList $ do action 4 tFilterMap (\x -> if even x then Just (x + 1) else Nothing) $ do action 5 action 6 action 7 :} [4,7,7]
Types
type Transaction a = TransactionM a () Source #
data TransactionM a x Source #