Copyright | Kadzuya Okamoto 2018 |
---|---|
License | MIT |
Stability | experimental |
Portability | unknown |
Safe Haskell | Safe |
Language | Haskell2010 |
Monadic representation of transactions.
- 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]
Converters
reduce :: (b -> a -> b) -> b -> Transaction a -> b Source #
toList :: Transaction a -> [a] Source #
tMap :: (a -> b) -> Transaction a -> Transaction b Source #
>>>
:{
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 #
>>>
:{
toList $ do action 4 tFilter even $ do action 5 action 6 action 7 :} [4,6,7]
tFilterMap :: (a -> Maybe b) -> Transaction a -> Transaction b Source #
>>>
:{
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 #
Monad (TransactionM a) Source # | |
Functor (TransactionM a) Source # | |
Applicative (TransactionM a) Source # | |