If exit-code is non-zero, fail with the stderr message; otherwise return the result
io.checked
Pipeline-friendly check: bind the preceding IO action through io.check
io.fail(msg)
Fail the IO action with the given error message
io.map(f, action)
Apply a pure function to the result of an IO action (fmap)
io.and-then(f, action)
Pass the result of action to f (bind with flipped args, for pipeline use)
io.then(b, a)
Sequence two actions, discarding the result of the first. Pipeline: a io.then(b)
io.join(mm)
Flatten a nested IO action
io.sequence(ms)
Run a list of IO actions in order, collecting results into a list
io.map-m(f, xs)
Apply f to each element of xs (producing IO actions), then sequence
io.filter-m(p, xs)
Monadic filter: keep elements where p returns a truthy IO action
The combinators map, then, join, sequence, map-m, and
filter-m are derived automatically via monad(). See the
Monads guide for details on the derivation
pattern and the IO guide for practical usage.
Function
Description
monad(m)
Derive standard monad combinators from m.bind and m.return
monad(m).bind
Passed through from m.bind
monad(m).return
Passed through from m.return
monad(m).map(f, action)
Apply pure function f to the result of a monadic action (fmap)
monad(m).and-then(f, action)
Pass the result of action to f (bind with flipped args, for pipeline use)
monad(m).then(b, a)
Sequence two monadic actions, discarding the result of the first. Pipeline: a m.then(b)
monad(m).join(mm)
Flatten a nested monadic value
monad(m).sequence(ms)
Sequence a list of monadic actions, collecting results into a list
monad(m).map-m(f, xs)
Apply f to each element of xs (producing actions), then sequence
monad(m).filter-m(p, xs)
Monadic filter: apply predicate p (returning a monadic bool) to each element