distributors-grammar
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.Grammar.Printor

Contents

Description

 
Synopsis

Printor

newtype Printor s (f :: Type -> Type) a b Source #

Printor is a simple printer Profunctor.

Constructors

Printor 

Fields

Instances

Instances details
Monad f => Category (Printor s f :: Type -> Type -> Type) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

id :: Printor s f a a #

(.) :: Printor s f b c -> Printor s f a b -> Printor s f a c #

(a ~ Item s, Cons s s a a, Applicative m) => TerminalSymbol a (Printor s m () ()) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

terminal :: [a] -> Printor s m () () Source #

(Categorized a, a ~ Item s, IsList s, Cons s s a a, Filterable m, Alternative m, Monad m) => TokenAlgebra a (Printor s m a a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

tokenClass :: TokenClass a -> Printor s m a a Source #

(Categorized a, a ~ Item s, IsList s, Cons s s a a, Filterable m, Alternative m, Monad m) => Tokenized a (Printor s m a a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

anyToken :: Printor s m a a Source #

token :: a -> Printor s m a a Source #

oneOf :: Foldable f => f a -> Printor s m a a Source #

notOneOf :: Foldable f => f a -> Printor s m a a Source #

asIn :: Categorize a -> Printor s m a a Source #

notAsIn :: Categorize a -> Printor s m a a Source #

MonadicTrans (Printor s) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

liftP :: Monad m => m b -> Printor s m a b #

joinP :: Monad m => Printor s m a (m b) -> Printor s m a b #

Alternative f => Alternator (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

someP :: Printor s f a b -> Printor s f [a] [b] #

optionP :: APrism a b () () -> Printor s f a b -> Printor s f a b #

manyTillP :: Printor s f a b -> Printor s f [a] [b] -> Printor s f [a] [b] #

quantP :: Int -> Maybe Int -> Printor s f a b -> Printor s f [a] [b] #

Applicative f => Distributor (Printor s f) Source #

manyP & optionalP print their elements in turn, rather than through isomorphisms & sums.

Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

optionalP :: Printor s f a b -> Printor s f (Maybe a) (Maybe b) #

manyP :: Printor s f a b -> Printor s f [a] [b] #

Filterable f => Filtrator (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

filtrate :: Printor s f (Either a c) (Either b d) -> (Printor s f a b, Printor s f c d) #

Alternative f => CocartesianChoice (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

alternate :: Either (Printor s f a b) (Printor s f c d) -> Printor s f (Either a c) (Either b d) #

Functor f => CocartesianMonoidal (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

zeroP :: Printor s f Void Void #

(>+<) :: Printor s f a b -> Printor s f c d -> Printor s f (Either a c) (Either b d) #

Applicative f => NotFollowedBy (Printor s f) Source # 
Instance details

Defined in Control.Lens.Grammar.Prec

Methods

notFollowedBy :: RegEx Char -> Printor s f () () Source #

Monad f => Arrow (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

arr :: (b -> c) -> Printor s f b c #

first :: Printor s f b c -> Printor s f (b, d) (c, d) #

second :: Printor s f b c -> Printor s f (d, b) (d, c) #

(***) :: Printor s f b c -> Printor s f b' c' -> Printor s f (b, b') (c, c') #

(&&&) :: Printor s f b c -> Printor s f b c' -> Printor s f b (c, c') #

(Alternative f, Monad f) => ArrowChoice (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

left :: Printor s f b c -> Printor s f (Either b d) (Either c d) #

right :: Printor s f b c -> Printor s f (Either d b) (Either d c) #

(+++) :: Printor s f b c -> Printor s f b' c' -> Printor s f (Either b b') (Either c c') #

(|||) :: Printor s f b d -> Printor s f c d -> Printor s f (Either b c) d #

(Alternative f, Monad f) => ArrowPlus (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

(<+>) :: Printor s f b c -> Printor s f b c -> Printor s f b c #

(Alternative f, Monad f) => ArrowZero (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

zeroArrow :: Printor s f b c #

Alternative f => Choice (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

left' :: Printor s f a b -> Printor s f (Either a c) (Either b c) #

right' :: Printor s f a b -> Printor s f (Either c a) (Either c b) #

Filterable f => Cochoice (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

unleft :: Printor s f (Either a d) (Either b d) -> Printor s f a b #

unright :: Printor s f (Either d a) (Either d b) -> Printor s f a b #

Functor f => Strong (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

first' :: Printor s f a b -> Printor s f (a, c) (b, c) #

second' :: Printor s f a b -> Printor s f (c, a) (c, b) #

Functor f => Profunctor (Printor s f) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

dimap :: (a -> b) -> (c -> d) -> Printor s f b c -> Printor s f a d #

lmap :: (a -> b) -> Printor s f b c -> Printor s f a c #

rmap :: (b -> c) -> Printor s f a b -> Printor s f a c #

(#.) :: forall a b c q. Coercible c b => q b c -> Printor s f a b -> Printor s f a c #

(.#) :: forall a b c q. Coercible b a => Printor s f b c -> q a b -> Printor s f a c #

Alternative f => Alternative (Printor s f a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

empty :: Printor s f a a0 #

(<|>) :: Printor s f a a0 -> Printor s f a a0 -> Printor s f a a0 #

some :: Printor s f a a0 -> Printor s f a [a0] #

many :: Printor s f a a0 -> Printor s f a [a0] #

Applicative f => Applicative (Printor s f a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

pure :: a0 -> Printor s f a a0 #

(<*>) :: Printor s f a (a0 -> b) -> Printor s f a a0 -> Printor s f a b #

liftA2 :: (a0 -> b -> c) -> Printor s f a a0 -> Printor s f a b -> Printor s f a c #

(*>) :: Printor s f a a0 -> Printor s f a b -> Printor s f a b #

(<*) :: Printor s f a a0 -> Printor s f a b -> Printor s f a a0 #

Functor f => Functor (Printor s f a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

fmap :: (a0 -> b) -> Printor s f a a0 -> Printor s f a b #

(<$) :: a0 -> Printor s f a b -> Printor s f a a0 #

Monad f => Monad (Printor s f a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

(>>=) :: Printor s f a a0 -> (a0 -> Printor s f a b) -> Printor s f a b #

(>>) :: Printor s f a a0 -> Printor s f a b -> Printor s f a b #

return :: a0 -> Printor s f a a0 #

(Alternative f, Monad f) => MonadPlus (Printor s f a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

mzero :: Printor s f a a0 #

mplus :: Printor s f a a0 -> Printor s f a a0 -> Printor s f a a0 #

(Alternative m, Monad m) => MonadFail (Printor s m a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

fail :: String -> Printor s m a a0 #

Filterable f => Filterable (Printor s f a) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

mapMaybe :: (a0 -> Maybe b) -> Printor s f a a0 -> Printor s f a b #

catMaybes :: Printor s f a (Maybe a0) -> Printor s f a a0 #

filter :: (a0 -> Bool) -> Printor s f a a0 -> Printor s f a a0 #

drain :: Printor s f a a0 -> Printor s f a b #

Alternative f => DisjunctiveMonoid (Printor s f a b) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

falseP :: Printor s f a b #

(>|<) :: Printor s f a b -> Printor s f a b -> Printor s f a b #

BackusNaurForm (Printor s m a b) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

ruleRec :: String -> (Printor s m a b -> Printor s m a b) -> Printor s m a b Source #

Ruled (Printor s m a b) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

rule :: String -> Printor s m a b -> Printor s m a b Source #

Tried (Printor s m a b) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

try :: Printor s m a b -> Printor s m a b Source #

(Char ~ Item s, Cons s s Char Char, Applicative m) => IsString (Printor s m () ()) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

fromString :: String -> Printor s m () () #

(Char ~ Item s, IsList s, Cons s s Char Char, AsEmpty s, Filterable m, Alternative m, Monad m) => IsString (Printor s m s s) Source # 
Instance details

Defined in Data.Profunctor.Grammar.Printor

Methods

fromString :: String -> Printor s m s s #

printP :: Functor f => Printor s f a b -> a -> f (s -> s) Source #

Run the printer on a value, returning a function that conses tokens at the beginning of an input string, from right to left.