Skip to content

Instantly share code, notes, and snippets.

@bradparker
Created March 25, 2021 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradparker/040acc8409b26bd1f7a7283c666017ec to your computer and use it in GitHub Desktop.
Save bradparker/040acc8409b26bd1f7a7283c666017ec to your computer and use it in GitHub Desktop.
filtering ::
Applicative f =>
(a -> f Bool)
-> List a
-> f (List a)
filtering p =
flip foldRight (pure Nil) $ \a fas ->
(\b as -> bool as (a :. as) b) <$> p a <*> fas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment