ekmett / machines

Networks of composable stream transducers
Other
339 stars 46 forks source link

takingJusts #102

Closed bens closed 6 years ago

bens commented 6 years ago

A Process that passes through elements unwrapped from Just until a Nothing is found, then stops.

This can be constructed from a plan with

takingJusts :: Process (Maybe a) a
takingJusts = repeatedly $ await >>= maybe stop yield

Examples:

>>> run $ takingJusts <~ source [Just 1, Just 2, Nothing, Just 3, Just 4]
[1,2]
YoEight commented 6 years ago

Thanks for your work. Could you use a more detailed commit message? For instance, Implement takingJusts?

bens commented 6 years ago

I've changed the commit message to be a bit more descriptive, thanks @YoEight.

YoEight commented 6 years ago

Thanks!