3 ms·
If node is a list of children that are wrapped in Maybes you could do something like this: map process $ catMaybes node (catMaybes :: [Maybe a] -> [a] -
by kyllo 11y ago
If node is a list of children that are wrapped in Maybes you could do something like this:
map process $ catMaybes node
(catMaybes :: [Maybe a] -> [a] - The catMaybes function takes a list of Maybes and returns a list of all the Just values.) https://www.haskell.org/hoogle/?hoogle=catMaybes https://www.haskell.org/hoogle/?hoogle=catMaybes
edit: and even if it's not a list, there's a more general implentation of catMaybes for any type that fulfills isSequence here: https://github.com/snoyberg/mono-traversable/blob/master/src/Data/Sequences.hs#L1527 https://github.com/snoyberg/mono-traversable/blob/master/src...