Commit 63eaecb7 authored by Kai-Oliver Prott's avatar Kai-Oliver Prott
Browse files

Optimize default implementations in Alternative class

parent f4aaf9ba
......@@ -1234,14 +1234,14 @@ class Applicative f => Alternative f where
some v = some_v
where
many_v = some_v <|> pure []
some_v = liftA2 (:) v many_v
some_v = (:) <$> v <*> many_v
-- | Zero or more.
many :: f a -> f [a]
many v = many_v
where
many_v = some_v <|> pure []
some_v = liftA2 (:) v many_v
some_v = (:) <$> v <*> many_v
instance Alternative [] where
empty = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment