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

Language | Haskell2010 |

- type Tube a b m r = FreeT (TubeF a b) m r
- newtype TubeF a b k = TubeF {
- runT :: forall r. ((a -> k) -> r) -> ((b, k) -> r) -> r

- type Source b m r = forall x. Tube x b m r
- type Sink a m r = forall x. Tube a x m r
- type Action m r = forall x. Tube x x m r
- run :: FreeT f m a -> m (FreeF f a (FreeT f m a))
- await :: Monad m => Tube a b m a
- yield :: Monad m => b -> Tube a b m ()
- yieldF :: b -> k -> TubeF a b k
- awaitF :: (a -> k) -> TubeF a b k
- liftT :: (MonadTrans t, Monad m) => FreeT f m a -> t m (FreeF f a (FreeT f m a))
- each :: (Monad m, Foldable t) => t b -> Tube a b m ()
- for :: Monad m => Tube a b m r -> (b -> Tube a c m s) -> Tube a c m r
- (><) :: Monad m => Tube a b m r -> Tube b c m r -> Tube a c m r
- (>-) :: Monad m => Tube a b m r -> (b -> Tube b c m r) -> Tube a c m r
- (~>) :: Monad m => Tube a b m r -> (b -> Tube a c m s) -> Tube a c m r

# Documentation

`TubeF`

is the union of unary functions and binary products into a single
type, here defined with a Boehm-Berarducci encoding.

Rather than using a normal ADT, which would certainly make the code a bit easier to read and write, a value of this type is actually a control flow mechanism accepting two continuations and choosing one or the other.

Client code should never actually have to deal with this.

(><) :: Monad m => Tube a b m r -> Tube b c m r -> Tube a c m r infixl 3 Source

Compose two tasks in a pull-based stream