Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- find ::
- (a -> Bool)
- -> List a
- -> Optional a
- find p = foldLeft f Empty
- where
- f :: Optional a -> a -> Optional a
- f Empty a | p a = Full a
- | otherwise = Empty
- f (Full a) _ = Full a
Advertisement