Find the first element of a list for which the operation returns Just, along with the result of the operation. Like find but useful where the function also computes some expensive information that can be reused. Particular useful when the function is monadic, see firstJustM.
firstJust id [Nothing,Just 3] == Just 3
firstJust id [Nothing,Nothing] == Nothing
should it not be ???
firstJust pure [Nothing,Just 3] == Just 3
firstJust pure [Nothing,Nothing] == Nothing
OR
firstJust Just [Nothing,Just 3] == Just 3
firstJust Just [Nothing,Nothing] == Nothing
firstJust :: (a -> Maybe b) -> [a] -> Maybe b
Find the first element of a list for which the operation returns Just, along with the result of the operation. Like find but useful where the function also computes some expensive information that can be reused. Particular useful when the function is monadic, see firstJustM.
should it not be ???
OR