distributors-0.6.0.0: Unifying Parsers, Printers & Grammars
Copyright(C) 2026 - Eitan Chatav
LicenseBSD-style (see the file LICENSE)
MaintainerEitan Chatav <eitan.chatav@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Profunctor.Separator

Description

 
Synopsis

SepBy

data SepBy p Source #

Used to sequence multiple times, separated by a separateBy, begun by a beginBy, and ended by an endBy.

Constructors

SepBy 

Fields

Instances

Instances details
Foldable SepBy Source # 
Instance details

Defined in Data.Profunctor.Separator

Methods

fold :: Monoid m => SepBy m -> m #

foldMap :: Monoid m => (a -> m) -> SepBy a -> m #

foldMap' :: Monoid m => (a -> m) -> SepBy a -> m #

foldr :: (a -> b -> b) -> b -> SepBy a -> b #

foldr' :: (a -> b -> b) -> b -> SepBy a -> b #

foldl :: (b -> a -> b) -> b -> SepBy a -> b #

foldl' :: (b -> a -> b) -> b -> SepBy a -> b #

foldr1 :: (a -> a -> a) -> SepBy a -> a #

foldl1 :: (a -> a -> a) -> SepBy a -> a #

toList :: SepBy a -> [a] #

null :: SepBy a -> Bool #

length :: SepBy a -> Int #

elem :: Eq a => a -> SepBy a -> Bool #

maximum :: Ord a => SepBy a -> a #

minimum :: Ord a => SepBy a -> a #

sum :: Num a => SepBy a -> a #

product :: Num a => SepBy a -> a #

Traversable SepBy Source # 
Instance details

Defined in Data.Profunctor.Separator

Methods

traverse :: Applicative f => (a -> f b) -> SepBy a -> f (SepBy b) #

sequenceA :: Applicative f => SepBy (f a) -> f (SepBy a) #

mapM :: Monad m => (a -> m b) -> SepBy a -> m (SepBy b) #

sequence :: Monad m => SepBy (m a) -> m (SepBy a) #

Functor SepBy Source # 
Instance details

Defined in Data.Profunctor.Separator

Methods

fmap :: (a -> b) -> SepBy a -> SepBy b #

(<$) :: a -> SepBy b -> SepBy a #

Read p => Read (SepBy p) Source # 
Instance details

Defined in Data.Profunctor.Separator

Show p => Show (SepBy p) Source # 
Instance details

Defined in Data.Profunctor.Separator

Methods

showsPrec :: Int -> SepBy p -> ShowS #

show :: SepBy p -> String #

showList :: [SepBy p] -> ShowS #

Eq p => Eq (SepBy p) Source # 
Instance details

Defined in Data.Profunctor.Separator

Methods

(==) :: SepBy p -> SepBy p -> Bool #

(/=) :: SepBy p -> SepBy p -> Bool #

Ord p => Ord (SepBy p) Source # 
Instance details

Defined in Data.Profunctor.Separator

Methods

compare :: SepBy p -> SepBy p -> Ordering #

(<) :: SepBy p -> SepBy p -> Bool #

(<=) :: SepBy p -> SepBy p -> Bool #

(>) :: SepBy p -> SepBy p -> Bool #

(>=) :: SepBy p -> SepBy p -> Bool #

max :: SepBy p -> SepBy p -> SepBy p #

min :: SepBy p -> SepBy p -> SepBy p #

sepBy :: Applicative p => p () -> SepBy (p ()) Source #

A SepBy smart constructor, setting the separateBy field. Beginning and ending delimitors will be no-ops, except by modifier record updates beginBy or endBy.

noSep :: Applicative p => SepBy (p ()) Source #

A SepBy smart constructor for no separator, beginning or ending delimiters.

sepWith :: (Applicative p, TerminalSymbol c (p ())) => [c] -> SepBy (p ()) Source #

A SepBy smart constructor like sepBy, with a terminal argument. Beginning and ending delimitors will be no-ops, except by applying smart modifiers beginWith or endWith.

beginWith :: TerminalSymbol c p => [c] -> SepBy p -> SepBy p Source #

A SepBy smart modifier like beginBy, with a terminal argument.

endWith :: TerminalSymbol c p => [c] -> SepBy p -> SepBy p Source #

A SepBy smart modifier like endBy, with a terminal argument.

SepBy Combinators

several :: (IsList s, IsList t, Distributor p) => SepBy (p () ()) -> p (Item s) (Item t) -> p s t Source #

several noSep = manyP

several1 :: (IsList s, IsList t, Distributor p, Choice p) => SepBy (p () ()) -> p (Item s) (Item t) -> p s t Source #

several1 noSep = someP

chain Source #

Arguments

:: Alternator p 
=> (forall x. x -> Either x x)

Left or Right associate

-> APartialIso a b (a, a) (b, b)

binary constructor pattern

-> APrism a b () ()

nilary constructor pattern

-> SepBy (p () ()) 
-> p a b 
-> p a b 

Use a nilary constructor pattern to sequence zero times, or associate a binary constructor pattern to sequence one or more times.

chain1 Source #

Arguments

:: (Distributor p, Choice p) 
=> (forall x. x -> Either x x)

Left or Right associate

-> APartialIso a b (a, a) (b, b)

binary constructor pattern

-> SepBy (p () ()) 
-> p a b 
-> p a b 

Associate a binary constructor pattern to sequence one or more times.

intercalateP Source #

Arguments

:: (Monoidal p, Choice p, AsEmpty s, Cons s s a a) 
=> Int

number of repetitions

-> SepBy (p () ()) 
-> p a a 
-> p s s 

Add a SepBy to replicateP using intercalateP.