|
definition: |
class Applicative f => Alternative f where
-- | The identity of '<|>'
empty :: f a
-- | An associative binary operation
(<|>) :: f a -> f a -> f a
-- | One or more.
some :: f a -> f [a]
some v = some_ v
where
many_ x = some_ x <|> pure []
some_ x = (:) <$> x <*> many_ x
-- | Zero or more.
many :: f a -> f [a]
many v = many_ v
where
many_ x = some_ x <|> pure []
some_ x = (:) <$> x <*> many_ x
|
|
documentation: |
| A monoid on applicative functors. If defined, 'some' and 'many' should be the least solutions of the equations: * `some v = (:) <$> v <*> many v` * `many v = some v <|> pure []` |
|
methods: |
["empty :: a b","(<|>) :: a b -> a b -> a b","some 1 :: a b -> a [b]","many 1 :: a b -> a [b]"] |
|
name: |
Alternative |