JoelSjogren

Untitled

Jul 18th, 2017
295
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. find ::
  2.   (a -> Bool)
  3.   -> List a
  4.   -> Optional a
  5. find p = foldLeft f Empty
  6.   where
  7.     f :: Optional a -> a -> Optional a
  8.     f Empty a | p a = Full a
  9.               | otherwise = Empty
  10.     f (Full a) _ = Full a
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment