Control.Applicative.Monoid

incremental-parser-0.2.5: Generic parser library capable of providing partial results from partial input.

Safe Haskell | Safe
Language | Haskell2010

Control.Applicative.Monoid

Description

This module defines the `MonoidApplicative` and `MonoidAlternative` type classes. Their methods are specialized forms of the standard `Applicative` and `Alternative` class methods. Instances of these classes should override the default method implementations with more efficient ones.

# Documentation

class Applicative f => MonoidApplicative f where #

Methods

(+<*>) :: f (a -> a) -> f a -> f a infixl 4 #

A variant of the Applicative's `<*>` operator specialized for endomorphic functions.

(><) :: Monoid a => f a -> f a -> f a infixl 5 #

Lifted and potentially optimized monoid `mappend` operation from the parameter type.

Instances

Monoid s => MonoidApplicative (Parser t s) # | The `+<*>` operator is specialized to return incremental parsing results.
Methods (+<*>) :: Parser t s (a -> a) -> Parser t s a -> Parser t s a # (><) :: Monoid a => Parser t s a -> Parser t s a -> Parser t s a #

class (Alternative f, MonoidApplicative f) => MonoidAlternative f where #

Methods

moptional :: Monoid a => f a -> f a #

Like `optional`, but restricted to `Monoid` results.

concatMany :: Monoid a => f a -> f a #

Zero or more argument occurrences like `many`, but concatenated.

concatSome :: Monoid a => f a -> f a #

One or more argument occurrences like `some`, but concatenated.

Instances

(Alternative (Parser t s), Monoid s) => MonoidAlternative (Parser t s) # |
Methods moptional :: Monoid a => Parser t s a -> Parser t s a # concatMany :: Monoid a => Parser t s a -> Parser t s a # concatSome :: Monoid a => Parser t s a -> Parser t s a #