Skip to content

Instantly share code, notes, and snippets.

@adamczykm
Last active November 19, 2018 18:32
Show Gist options
  • Save adamczykm/047931f25f11a3da330df8ff672ede4c to your computer and use it in GitHub Desktop.
Save adamczykm/047931f25f11a3da330df8ff672ede4c to your computer and use it in GitHub Desktop.
Alternative + Foldable = Container
include :: forall a f. Alternative f => a -> f a -> f a
include a f = pure a <|> f
select :: forall a f. Functor f => Foldable f => f a -> Maybe a
select f = unwrap $ fold (First <<< Just <$> f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment