linsyking / elm-monad / Monad.List

List Monad

Computations which may return 0, 1, or more possible results.

Binding strategy: The bound function is applied to all possible values in the input list and the resulting lists are concatenated to produce a list of all possible results.

Useful for: Building computations from sequences of non-deterministic operations. Parsing ambiguous grammars is a common example.

return : a -> List a

return function for List

bind : List a -> (a -> List b) -> List b

bind function for List

The behavior is the same as the concatMap

fail : a -> List a

fail function for List