Extensions to Maybe and Maybe.Extra modules
providing functions to work with List.NoneEmpty.NonEmpty.
It's safe to import this module as Maybe:
import Maybe.NonEmpty as Maybeall functions in this module use Ne suffix to prevent collisions with
List based alternatives.
Like combineNe, but map a function over each element of the list first.
If every function call succeeds (returns Just), traverseNe will return a non empty list.
If any function call fails (returns Nothing), traverse will return Nothing.
combineNe is equivalent to traverseNe identity.
traverseNe (\x -> Just (x * 10)) ( 1, [ 2, 3, 4, 5 ] )
--> Just ( 10, [ 20, 30, 40, 50 ] )
traverseNe List.head ( [1], [ [2, 3], [] ] )
--> Nothing
If every
Maybein the none empty list is present, return all of the values unwrapped. If there are anyNothings, the whole function fails and returnsNothing.