Last active
November 19, 2018 18:32
-
-
Save adamczykm/047931f25f11a3da330df8ff672ede4c to your computer and use it in GitHub Desktop.
Alternative + Foldable = Container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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