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

Common.Parsing.ParseOr

Description

Provides the ParseOr monoid.

Synopsis

Documentation

newtype ParseOr acc Source #

ParseOr Induces an "Or" monoidal structure on ParseStatus. That is,

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

The algebra for ParseOr satisfies

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

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

Constructors

ParseOr (ParseStatus acc) 

Instances

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

Defined in Common.Parsing.ParseOr

Methods

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

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

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

Defined in Common.Parsing.ParseOr

Methods

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

show :: ParseOr acc -> String #

showList :: [ParseOr acc] -> ShowS #

Semigroup (ParseOr acc) Source # 
Instance details

Defined in Common.Parsing.ParseOr

Methods

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

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

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

Monoid (ParseOr acc) Source # 
Instance details

Defined in Common.Parsing.ParseOr

Methods

mempty :: ParseOr acc #

mappend :: ParseOr acc -> ParseOr acc -> ParseOr acc #

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