cli-utils-4.1.0
LicenseBSD3
Maintainertbidne@gmail.com
Safe HaskellSafe
LanguageHaskell2010

Common.Parsing.ParseAnd

Description

Provides the ParseAnd monoid.

Synopsis

Documentation

newtype ParseAnd acc Source #

ParseAnd induces an "And" monoidal structure on Monoid acc => ParseStatus acc. That is,

  (PSuccess p1) <> ... <> (PSuccess pn) = PSuccess (p1 <> ... <> pn)
  (PSuccess p1) <> ... <> (PSuccess pj) <> (PFailure pk) ... = PFailure pk

The algebra for ParseAnd satisfies

  1. Identity: ParseAnd (PSuccess mempty)
  2. PFailure is an ideal: PFailure x <> PSuccess y == PFailure x == PSuccess y <> PFailure x
  3. Left-biased: l <> r == l, when it doesn't violate 1 or 2.

Strictly speaking property 2 is stronger than saying PFailure is an ideal. More precisely, the action by PSuccess on PFailure in ParseAnd is trivial.

Constructors

ParseAnd (ParseStatus acc) 

Instances

Instances details
Eq acc => Eq (ParseAnd acc) Source # 
Instance details

Defined in Common.Parsing.ParseAnd

Methods

(==) :: ParseAnd acc -> ParseAnd acc -> Bool #

(/=) :: ParseAnd acc -> ParseAnd acc -> Bool #

Show acc => Show (ParseAnd acc) Source # 
Instance details

Defined in Common.Parsing.ParseAnd

Methods

showsPrec :: Int -> ParseAnd acc -> ShowS #

show :: ParseAnd acc -> String #

showList :: [ParseAnd acc] -> ShowS #

Semigroup acc => Semigroup (ParseAnd acc) Source # 
Instance details

Defined in Common.Parsing.ParseAnd

Methods

(<>) :: ParseAnd acc -> ParseAnd acc -> ParseAnd acc #

sconcat :: NonEmpty (ParseAnd acc) -> ParseAnd acc #

stimes :: Integral b => b -> ParseAnd acc -> ParseAnd acc #

Monoid acc => Monoid (ParseAnd acc) Source # 
Instance details

Defined in Common.Parsing.ParseAnd

Methods

mempty :: ParseAnd acc #

mappend :: ParseAnd acc -> ParseAnd acc -> ParseAnd acc #

mconcat :: [ParseAnd acc] -> ParseAnd acc #