Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pipes by Example

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Pipes by Example

Presented to YOW! Lambda Jam 2014.

Avatar for Nick Partridge

Nick Partridge

May 09, 2014
Tweet

Other Decks in Programming

Transcript

  1. Pipe a b m r a b m On exhaustion:

    r Proxy () a () b m r
  2. Use the Monad Running producers sequentially is just >> When

    pipes/consumers/producers/finish, they return a value Control.Monad and friends are very useful.
  3. Elimination - Loop Bodies for generator body ! for x

    yield == x for (yield x) f == f x
  4. 1. Pipes Parse type Parser a m r = forall

    x. StateT (Producer a m x) m r Provides ‘push-back’. You can modify the underlying producer to return a value again.
  5. 2. Pipes Safe ReaderT (IORef (Finalizers m)) m r Resource

    management, exception safety, through a monad transformer on m that allows registering Finalizers.
  6. 3. Pipes Group FreeT (Producer a m) m x Working

    on sub-streams in constant memory. a ‘linked-list’ of sub-stream producers, each one returning the next sub-stream on exhaustion
  7. References Pipes haddocks - Pipes, Pipes.Prelude, Pipes.Tutorial Haskell for All

    - Gabriel Gonzales’ blog Haskell Pipes Google Group “pipes-“ seach on hackage