Safe Haskell | Safe |
---|---|

Language | Haskell98 |

Bifunctors and more.

Used primarily for transactions, which are parametrized in both input scripts and output scripts.

- class BiFunctor f where
- class BiFoldable f where
- toListFst :: BiFoldable f => f a b -> [a]
- toListSnd :: BiFoldable f => f a b -> [b]
- class BiTraversable f where
- mapAccumLFst_ :: BiTraversable f => (acc -> b -> (acc, c)) -> acc -> f b d -> f c d
- mapAccumLSnd_ :: BiTraversable f => (acc -> c -> (acc, d)) -> acc -> f b c -> f b d
- mapAccumLBoth_ :: BiTraversable f => (acc -> b -> (acc, d)) -> (acc -> c -> (acc, e)) -> acc -> f b c -> f d e
- zipWithFst :: BiTraversable f => (x -> a -> b) -> [x] -> f a c -> f b c
- zipWithSnd :: BiTraversable f => (y -> b -> c) -> [y] -> f a b -> f a c

# Documentation

class BiFoldable f where Source #

toListFst :: BiFoldable f => f a b -> [a] Source #

toListSnd :: BiFoldable f => f a b -> [b] Source #

class BiTraversable f where Source #

This is a rather nonstandard version of traverseable, but this is what we need

mapAccumLFst :: (acc -> b -> (acc, c)) -> acc -> f b d -> (acc, f c d) Source #

mapAccumLSnd :: (acc -> c -> (acc, d)) -> acc -> f b c -> (acc, f b d) Source #

mapAccumLBoth :: (acc -> b -> (acc, d)) -> (acc -> c -> (acc, e)) -> acc -> f b c -> (acc, f d e) Source #

mapAccumLFst_ :: BiTraversable f => (acc -> b -> (acc, c)) -> acc -> f b d -> f c d Source #

mapAccumLSnd_ :: BiTraversable f => (acc -> c -> (acc, d)) -> acc -> f b c -> f b d Source #

mapAccumLBoth_ :: BiTraversable f => (acc -> b -> (acc, d)) -> (acc -> c -> (acc, e)) -> acc -> f b c -> f d e Source #

zipWithFst :: BiTraversable f => (x -> a -> b) -> [x] -> f a c -> f b c Source #

Note: this is unsafe (the list must be long enough)

zipWithSnd :: BiTraversable f => (y -> b -> c) -> [y] -> f a b -> f a c Source #