Helpers for error handling with multiple Maybe values
Given a 3-tuple of Maybe values, if all three values are defined, return
Just the 3-tuple of values; otherwise, return Nothing
Given a 4-tuple of Maybe values, if all four values are defined, return
Just the 4-tuple of values; otherwise, return Nothing
Given a list of Maybe values, if all values are defined, return
Just the list of values; otherwise, return Nothing. When passed an empty
list, returns Just an empty list.
[Just 1, Just 2]
|> Toolkit.Maybe.zipList
--> Just [1,2]
[Just 1, Nothing]
|> Toolkit.Maybe.zipList
--> Nothing
[]
|> Toolkit.Maybe.zipList
--> Just []Given a list of Maybe values, return a list containing only the defined
values.
[ Just 1
, Just 2
, Nothing
]
|> Toolkit.Maybe.filter
--> [1, 2]
Given a 2-tuple of
Maybevalues, if both values are defined, returnJustthe 2-tuple of values; otherwise, returnNothing