6 ms·
There's also another option in the middle which is a version that takes a value to return when the list is empty headOr :: a -> [a] -> a which is similar
by lgas 7y ago
There's also another option in the middle which is a version that takes a value to return when the list is empty
headOr :: a -> [a] -> a
which is similar to the Maybe solution but forces the caller to discharge the Maybe immediately rather than letting them potentially clutter up the rest of their code by proliferating the Maybe.