pup-0.1.1: Invertible format descriptors
Safe HaskellNone
LanguageGHC2021

Text.Pup.Class

Description

This module declares common high-level format-descriptor classes which are largely independent from the particular backend. Classes in this module are abstract over the type of token that you parse or print. Classes specialised to certain tokens can be found in Text.Pup.Class.Char.

The relevant class are re-exported by the modules which define backends. So unless you are defining a new backend, you shouldn't have to import this module.

Many docstrings in this module are adapted from Megparsec (see Text.Megaparsec) and Prettyprinter (see Prettyprinter).

Synopsis

Basic token format descriptors

class (Eq tok, Eq chunk) => Tokens tok chunk (m :: Type -> Type -> Type -> Type) | m -> tok chunk where Source #

This class declares the basic format descriptors for tokens (what the theory of grammars call terminals).

Minimal complete definition

eof, single, satisfy, tokens, takeWhileP, takeWhile1P, takeP, label

Methods

eof :: m r r () Source #

As a parser, only succeeds at the end of input. No-op as a printer.

single :: tok -> m r r tok Source #

As a parser, single t only matches the single token t. As a printer, single t prints the token t.

semicolon = single ';'

See also: token, anySingle, Char.

satisfy :: (tok -> Bool) -> m (tok -> r) r tok Source #

As a parser satisfy p succeeds for any token for which the supplied predicate pf returns True. As a printer satisfy p prints its input token, provided predicate p@ returns True, and fails otherwise.

digitChar = satisfy isDigit <?> "digit"
oneOf cs  = satisfy (`elem` cs)

See also: anySingle, anySingleBut, oneOf, noneOf.

tokens Source #

Arguments

:: (chunk -> chunk -> Bool)

Predicate to check equality of chunks

-> chunk

Chunk of input to match against

-> m (chunk -> r) r chunk 

As a parser tokens test chk takes chunk chk' of input of length length chk and returns chk' if the equality test test chk chk' succeeds, and fails otherwise. As a printer, tokens test chk prints its input chunk chk' provided that length chk' = length chk and the equality test test chk chk' succeeds, and fails otherwise.

This can be used for example to write chunk:

chunk = tokens (==)

takeWhileP Source #

Arguments

:: Maybe String

(Optional) name for a single token, can be used in error messages

-> (tok -> Bool)

Predicate to use to test tokens

-> m (chunk -> r) r chunk 

As a parser, parses zero or more tokens for which the supplied predicate holds. As a printer, prints its input chunk of tokens, provided that each token in the chunk satisfies the predicate.

This is an optimised variant of a format descriptor built with many:

takeWhileP (Just "foo") f = many (satisfy f <?> "foo")
takeWhileP Nothing      f = many (satisfy f)

The parser side never fails, although it may parse the empty chunk.

takeWhile1P Source #

Arguments

:: Maybe String

(Optional) name for a single token, can be used in error messages

-> (tok -> Bool)

Predicate to use to test tokens

-> m (chunk -> r) r chunk 

Similar to takeWhileP, but fails if it can't parse or print at least one token.

This is an optimised variant of a format descriptor built with some:

takeWhile1P (Just "foo") f = some (satisfy f <?> "foo")
takeWhile1P Nothing      f = some (satisfy f)

takeP Source #

Arguments

:: Maybe String

Name for a single token in the row

-> Int

How many tokens to extract

-> m (chunk -> r) r chunk 

As a parser takeP lbl n returns the next n tokens from the input (it fails if there are not enough tokens in the input). As a printer, it prints its input chunk of tokens, provided that the chunk has exactly n tokens.

label :: String -> m r r' a -> m r r' a Source #

label lbl p gives a name to the next token expected by p. This is only really useful for the parser side, where it can be used to report error messages of the form “unexpected ..., expected lbl”.

hidden :: m r r' a -> m r r' a Source #

hidden p silences error messages of the form “unexpected ..., expected ...” in p (only relevant on the parser side).

Instances

Instances details
Tokens Char Text (Backend ann) Source # 
Instance details

Defined in Text.Pup.Backend.Prettyprinter

Methods

eof :: Backend ann r r () Source #

single :: Char -> Backend ann r r Char Source #

satisfy :: (Char -> Bool) -> Backend ann (Char -> r) r Char Source #

tokens :: (Text -> Text -> Bool) -> Text -> Backend ann (Text -> r) r Text Source #

takeWhileP :: Maybe String -> (Char -> Bool) -> Backend ann (Text -> r) r Text Source #

takeWhile1P :: Maybe String -> (Char -> Bool) -> Backend ann (Text -> r) r Text Source #

takeP :: Maybe String -> Int -> Backend ann (Text -> r) r Text Source #

label :: String -> Backend ann r r' a -> Backend ann r r' a Source #

hidden :: Backend ann r r' a -> Backend ann r r' a Source #

(MonadParsec err s m, tok ~ Token s, chunk ~ Tokens s, Eq tok, Eq chunk) => Tokens tok chunk (BackendGen m) Source # 
Instance details

Defined in Text.Pup.Backend.Megaparsec

Methods

eof :: BackendGen m r r () Source #

single :: tok -> BackendGen m r r tok Source #

satisfy :: (tok -> Bool) -> BackendGen m (tok -> r) r tok Source #

tokens :: (chunk -> chunk -> Bool) -> chunk -> BackendGen m (chunk -> r) r chunk Source #

takeWhileP :: Maybe String -> (tok -> Bool) -> BackendGen m (chunk -> r) r chunk Source #

takeWhile1P :: Maybe String -> (tok -> Bool) -> BackendGen m (chunk -> r) r chunk Source #

takeP :: Maybe String -> Int -> BackendGen m (chunk -> r) r chunk Source #

label :: String -> BackendGen m r r' a -> BackendGen m r r' a Source #

hidden :: BackendGen m r r' a -> BackendGen m r r' a Source #

Ord err => Tokens Char Text (Pup err ann) Source # 
Instance details

Defined in Text.Pup.MPR

Methods

eof :: Pup err ann r r () Source #

single :: Char -> Pup err ann r r Char Source #

satisfy :: (Char -> Bool) -> Pup err ann (Char -> r) r Char Source #

tokens :: (Text -> Text -> Bool) -> Text -> Pup err ann (Text -> r) r Text Source #

takeWhileP :: Maybe String -> (Char -> Bool) -> Pup err ann (Text -> r) r Text Source #

takeWhile1P :: Maybe String -> (Char -> Bool) -> Pup err ann (Text -> r) r Text Source #

takeP :: Maybe String -> Int -> Pup err ann (Text -> r) r Text Source #

label :: String -> Pup err ann r r' a -> Pup err ann r r' a Source #

hidden :: Pup err ann r r' a -> Pup err ann r r' a Source #

(Tokens tok chunk m1, Tokens tok chunk m2) => Tokens tok chunk (m1 :*: m2) Source # 
Instance details

Defined in Text.Pup.Class

Methods

eof :: (m1 :*: m2) r r () Source #

single :: tok -> (m1 :*: m2) r r tok Source #

satisfy :: (tok -> Bool) -> (m1 :*: m2) (tok -> r) r tok Source #

tokens :: (chunk -> chunk -> Bool) -> chunk -> (m1 :*: m2) (chunk -> r) r chunk Source #

takeWhileP :: Maybe String -> (tok -> Bool) -> (m1 :*: m2) (chunk -> r) r chunk Source #

takeWhile1P :: Maybe String -> (tok -> Bool) -> (m1 :*: m2) (chunk -> r) r chunk Source #

takeP :: Maybe String -> Int -> (m1 :*: m2) (chunk -> r) r chunk Source #

label :: String -> (m1 :*: m2) r r' a -> (m1 :*: m2) r r' a Source #

hidden :: (m1 :*: m2) r r' a -> (m1 :*: m2) r r' a Source #

(<?>) :: Tokens chunk tok m => m r r' a -> String -> m r r' a infix 0 Source #

A synonym for label in the form of an operator.

chunk Source #

Arguments

:: (Applicative m, Stacked m, Tokens tok chunk m) 
=> chunk

Chunk to match

-> m r r () 

chunk chk only matches the chunk chk.

divOrMod = chunk "div" <|> chunk "mod"

When tok is Char, it's customary for format descriptors to implement the IsString class with fromString = chunk.

See also: tokens, string.

anySingle :: Tokens tok chunk m => m (tok -> r) r tok Source #

Parses/prints a single token.

anySingle = satisfy (const True)

See also: satisfy, anySingleBut.

anySingleBut Source #

Arguments

:: Tokens tok chunk m 
=> tok

Token we should not match

-> m (tok -> r) r tok 

Parse/print any token but the given one. It's a good idea to attach a label to this format descriptor.

anySingleBut t = satisfy (/= t)

See also: single, anySingle, satisfy.

oneOf Source #

Arguments

:: (Foldable f, Tokens tok chunk m) 
=> f tok

Collection of matching tokens

-> m (tok -> r) r tok 

oneOf ts parses/prints any token from ts. Note that, as a parser, oneOf ts can't automatically generate “expected” tokens in error messages, so you should usually label it manually with label or (<?>).

oneOf cs = satisfy (`elem` cs)

See also: satisfy.

digit = oneOf ['0'..'9'] <?> "digit"

noneOf Source #

Arguments

:: (Foldable f, Tokens tok chunk m) 
=> f tok

Collection of taken we should not match

-> m (tok -> r) r tok 

As the dual of oneOf, noneOf ts succeeds and parses/prints the current token if the current token isn't in ts. Note that, as a parser, oneOf ts can't automatically generate “expected” tokens in error messages, so you should usually label it manually with label or (<?>).

noneOf cs = satisfy (`notElem` cs)

See also: satisfy.

takeRest :: Tokens tok chunk m => m (chunk -> r) r chunk Source #

As a parser, consume the rest of the input and return it as a chunk. As a parser takeRest never fails, but may return the empty chunk. As a printer, takeRest simply prints its input chunk.

takeRest = takeWhileP Nothing (const True)

atEnd :: (Alternative m, Tokens tok chunk m) => m r r Bool Source #

Return True when end of input has been reached.

atEnd = option False (True <$ hidden eof)

Breaks

class Breaks (m :: k -> k -> Type -> Type) where Source #

The typeclass Breaks m implements format descriptors which represents breaks. These are typically spaces and newlines. Because breaks can be many spaces and/or newlines, the printer side must make decisions about how many of which should be printed for a single break. Which is why these format descriptors aren't merely derived from satisfy.

Methods

space :: forall (r :: k). m r r () Source #

This parses 0 or more spaces/newline characters. As a printer a typical choice is to print no space at all.

space1 :: forall (r :: k). m r r () Source #

This parses 1 or more spaces/newline characters. As a printer a typical choice is to print a soft newline (see also group).

hardline :: forall (r :: k). m r r () Source #

This parses/prints a newline character.

Instances

Instances details
(MonadParsec err s m, Token s ~ Char) => Breaks (BackendGen m :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Backend.Megaparsec

Methods

space :: BackendGen m r r () Source #

space1 :: BackendGen m r r () Source #

hardline :: BackendGen m r r () Source #

Breaks (Backend ann :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Backend.Prettyprinter

Methods

space :: Backend ann r r () Source #

space1 :: Backend ann r r () Source #

hardline :: Backend ann r r () Source #

Ord err => Breaks (Pup err ann :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.MPR

Methods

space :: Pup err ann r r () Source #

space1 :: Pup err ann r r () Source #

hardline :: Pup err ann r r () Source #

Breaks m => Breaks (Trivial m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

space :: forall (r :: k). Trivial m r r () Source #

space1 :: forall (r :: k). Trivial m r r () Source #

hardline :: forall (r :: k). Trivial m r r () Source #

(Breaks m1, Breaks m2) => Breaks (m1 :*: m2 :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

space :: forall (r :: k). (m1 :*: m2) r r () Source #

space1 :: forall (r :: k). (m1 :*: m2) r r () Source #

hardline :: forall (r :: k). (m1 :*: m2) r r () Source #

Wadler-Leijen-style grouping

class Breaks m => WadlerLeijen (m :: k -> k -> Type -> Type) where Source #

A class abstracting over the layout strategy of Wadler-Leijen-type pretty printers. All these format descriptors are no-ops on the parser side.

Methods

group :: forall (r :: k) (r' :: k) a. m r r' a -> m r r' a Source #

group x tries laying out x into a single line by interpreting the contained line breaks (e.g. space1') as spaces; if this does not fit the page, or when a hardline (see hardline) within x prevents it from being flattened, x is laid out without any changes.

nest :: forall (r :: k) (r' :: k) a. Int -> m r r' a -> m r r' a Source #

nest i x lays out the document x with the current nesting level (indentation of the following lines) increased by i. Negative values are allowed, and decrease the nesting level accordingly.

>>> nest 4 ("lorem" <> space1 <> "ipsum" <> "dolor") <> line <> "sit" <> line "amet"
lorem
    ipsum
    dolor
sit
amet

Instances

Instances details
(MonadParsec err s m, Token s ~ Char) => WadlerLeijen (BackendGen m :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Backend.Megaparsec

Methods

group :: BackendGen m r r' a -> BackendGen m r r' a Source #

nest :: Int -> BackendGen m r r' a -> BackendGen m r r' a Source #

WadlerLeijen (Backend ann :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Backend.Prettyprinter

Methods

group :: Backend ann r r' a -> Backend ann r r' a Source #

nest :: Int -> Backend ann r r' a -> Backend ann r r' a Source #

Ord err => WadlerLeijen (Pup err ann :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.MPR

Methods

group :: Pup err ann r r' a -> Pup err ann r r' a Source #

nest :: Int -> Pup err ann r r' a -> Pup err ann r r' a Source #

Breaks m => WadlerLeijen (Trivial m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

group :: forall (r :: k) (r' :: k) a. Trivial m r r' a -> Trivial m r r' a Source #

nest :: forall (r :: k) (r' :: k) a. Int -> Trivial m r r' a -> Trivial m r r' a Source #

(WadlerLeijen m1, WadlerLeijen m2) => WadlerLeijen (m1 :*: m2 :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

group :: forall (r :: k) (r' :: k) a. (m1 :*: m2) r r' a -> (m1 :*: m2) r r' a Source #

nest :: forall (r :: k) (r' :: k) a. Int -> (m1 :*: m2) r r' a -> (m1 :*: m2) r r' a Source #

Look-ahead descriptors

class LookAhead (m :: Type -> Type -> Type -> Type) where Source #

This class declares look-ahead combinators. These allow parsers to react to the upcomming of the input without consuming it. They are ignored by printers.

Methods

lookAhead :: m (a -> r) r a -> m (a -> r) r a Source #

If p in lookAhead p succeeds (either consuming input or not) the whole parser behaves like p succeeded without consuming anything (parser state is not updated as well). If p fails lookAhead p fails without consuming input.

notFollowedBy :: m r r a -> m r r () Source #

notFollowedBy p only succeeds when the parser p fails. This parser never consumes any input and never modifies parser state. It can be used to implement the “longest match” rule.

Instances

Instances details
MonadParsec err s m => LookAhead (BackendGen m) Source # 
Instance details

Defined in Text.Pup.Backend.Megaparsec

Methods

lookAhead :: BackendGen m (a -> r) r a -> BackendGen m (a -> r) r a Source #

notFollowedBy :: BackendGen m r r a -> BackendGen m r r () Source #

LookAhead (Backend ann) Source # 
Instance details

Defined in Text.Pup.Backend.Prettyprinter

Methods

lookAhead :: Backend ann (a -> r) r a -> Backend ann (a -> r) r a Source #

notFollowedBy :: Backend ann r r a -> Backend ann r r () Source #

Ord err => LookAhead (Pup err ann) Source # 
Instance details

Defined in Text.Pup.MPR

Methods

lookAhead :: Pup err ann (a -> r) r a -> Pup err ann (a -> r) r a Source #

notFollowedBy :: Pup err ann r r a -> Pup err ann r r () Source #

(Applicative m, Shifty m) => LookAhead (Trivial m) Source # 
Instance details

Defined in Text.Pup.Class

Methods

lookAhead :: Trivial m (a -> r) r a -> Trivial m (a -> r) r a Source #

notFollowedBy :: Trivial m r r a -> Trivial m r r () Source #

(LookAhead m1, LookAhead m2) => LookAhead (m1 :*: m2) Source # 
Instance details

Defined in Text.Pup.Class

Methods

lookAhead :: (m1 :*: m2) (a -> r) r a -> (m1 :*: m2) (a -> r) r a Source #

notFollowedBy :: (m1 :*: m2) r r a -> (m1 :*: m2) r r () Source #

Semantic tagging

class Annotations ann (m :: k -> k1 -> k2 -> Type) where Source #

This class represents semantic tagging for printers. For instance, instructions to add colour or font styles which may not be available in all backends. A pup is `Annotate ann` when it supports tags of type ann'.

See also "Prettyprinter.annotate".

Methods

annotate :: forall (r :: k) (r' :: k1) (a :: k2). ann -> m r r' a -> m r r' a Source #

Instances

Instances details
Annotations ann (BackendGen m :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Backend.Megaparsec

Methods

annotate :: ann -> BackendGen m r r' a -> BackendGen m r r' a Source #

Annotations ann (Backend ann :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Backend.Prettyprinter

Methods

annotate :: ann -> Backend ann r r' a -> Backend ann r r' a Source #

Annotations ann (Pup err ann :: Type -> Type -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.MPR

Methods

annotate :: ann -> Pup err ann r r' a -> Pup err ann r r' a Source #

Annotations ann (Trivial m :: k1 -> k2 -> k3 -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

annotate :: forall (r :: k1) (r' :: k2) (a :: k3). ann -> Trivial m r r' a -> Trivial m r r' a Source #

(Annotations ann m1, Annotations ann m2) => Annotations ann (m1 :*: m2 :: k1 -> k2 -> k3 -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

annotate :: forall (r :: k1) (r' :: k2) (a :: k3). ann -> (m1 :*: m2) r r' a -> (m1 :*: m2) r r' a Source #

Parse errors

class ParseErrors e (m :: Type -> Type -> Type -> Type) where Source #

A class for error handling in parsers.

Methods

parseError :: e -> m r r' a Source #

Stop parsing and report the e as a parsing error. No-op as a printer.

withRecovery Source #

Arguments

:: (e -> m r r' a)

How to recover from failure

-> m r r' a

Original parser

-> m r r' a

Parser that can recover from failures

withRecovery r p allows us to continue parsing even if the parser p fails. In this case r is called with the actual ParseError as its argument. Typical usage is to return a value signifying failure to parse this particular object and to consume some part of the input up to the point where the next object starts.

Note that if r fails, the original error message is reported as if without withRecovery. In no way recovering parser r can influence error messages.

No-op as a printer.

observing Source #

Arguments

:: m (b -> r) r a

The parser to run

-> m (Either e b -> r) r (Either e a) 

observing p allows us to "observe" failure of the p parser, should it happen, without actually ending parsing but instead getting the ParseError in Left, and no input is consumed. On success parsed value is returned in Right as usual.

As a printer observing p is a no-op on Left and behaves like p on Right.

Instances

Instances details
ParseErrors e' (Backend ann) Source # 
Instance details

Defined in Text.Pup.Backend.Prettyprinter

Methods

parseError :: e' -> Backend ann r r' a Source #

withRecovery :: (e' -> Backend ann r r' a) -> Backend ann r r' a -> Backend ann r r' a Source #

observing :: Backend ann (b -> r) r a -> Backend ann (Either e' b -> r) r (Either e' a) Source #

(ParseErrors e m1, ParseErrors e m2) => ParseErrors e (m1 :*: m2) Source # 
Instance details

Defined in Text.Pup.Class

Methods

parseError :: e -> (m1 :*: m2) r r' a Source #

withRecovery :: (e -> (m1 :*: m2) r r' a) -> (m1 :*: m2) r r' a -> (m1 :*: m2) r r' a Source #

observing :: (m1 :*: m2) (b -> r) r a -> (m1 :*: m2) (Either e b -> r) r (Either e a) Source #

MonadParsec e s m => ParseErrors (ParseError s e) (BackendGen m) Source # 
Instance details

Defined in Text.Pup.Backend.Megaparsec

Methods

parseError :: ParseError s e -> BackendGen m r r' a Source #

withRecovery :: (ParseError s e -> BackendGen m r r' a) -> BackendGen m r r' a -> BackendGen m r r' a Source #

observing :: BackendGen m (b -> r) r a -> BackendGen m (Either (ParseError s e) b -> r) r (Either (ParseError s e) a) Source #

Ord err => ParseErrors (ParseError Text err) (Pup err ann) Source # 
Instance details

Defined in Text.Pup.MPR

Methods

parseError :: ParseError Text err -> Pup err ann r r' a Source #

withRecovery :: (ParseError Text err -> Pup err ann r r' a) -> Pup err ann r r' a -> Pup err ann r r' a Source #

observing :: Pup err ann (b -> r) r a -> Pup err ann (Either (ParseError Text err) b -> r) r (Either (ParseError Text err) a) Source #

Deriving-via

newtype Trivial (m :: k -> k1 -> k2 -> Type) (r :: k) (r' :: k1) (a :: k2) Source #

A deriving-via constructor to derive instances for the classes in this module which can be implemented as no-ops.

Constructors

MkTrivial (m r r' a) 

Instances

Instances details
Annotations ann (Trivial m :: k1 -> k2 -> k3 -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

annotate :: forall (r :: k1) (r' :: k2) (a :: k3). ann -> Trivial m r r' a -> Trivial m r r' a Source #

Breaks m => Breaks (Trivial m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

space :: forall (r :: k). Trivial m r r () Source #

space1 :: forall (r :: k). Trivial m r r () Source #

hardline :: forall (r :: k). Trivial m r r () Source #

Breaks m => WadlerLeijen (Trivial m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

group :: forall (r :: k) (r' :: k) a. Trivial m r r' a -> Trivial m r r' a Source #

nest :: forall (r :: k) (r' :: k) a. Int -> Trivial m r r' a -> Trivial m r r' a Source #

Applicative m => Applicative (Trivial m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

pure :: forall a (i :: k). a -> Trivial m i i a #

(<*>) :: forall (i :: k) (j :: k) a b (k1 :: k). Trivial m i j (a -> b) -> Trivial m j k1 a -> Trivial m i k1 b #

liftA2 :: forall a b c (i :: k) (j :: k) (k1 :: k). (a -> b -> c) -> Trivial m i j a -> Trivial m j k1 b -> Trivial m i k1 c #

(*>) :: forall (i :: k) (j :: k) a (k1 :: k) b. Trivial m i j a -> Trivial m j k1 b -> Trivial m i k1 b #

(<*) :: forall (i :: k) (j :: k) a (k1 :: k) b. Trivial m i j a -> Trivial m j k1 b -> Trivial m i k1 a #

Monad m => Monad (Trivial m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Text.Pup.Class

Methods

(>>=) :: forall (i :: k) (j :: k) a (k1 :: k) b. Trivial m i j a -> (a -> Trivial m j k1 b) -> Trivial m i k1 b #

(Applicative m, Shifty m) => LookAhead (Trivial m) Source # 
Instance details

Defined in Text.Pup.Class

Methods

lookAhead :: Trivial m (a -> r) r a -> Trivial m (a -> r) r a Source #

notFollowedBy :: Trivial m r r a -> Trivial m r r () Source #

Shifty m => Shifty (Trivial m) Source # 
Instance details

Defined in Text.Pup.Class

Methods

shift :: ((a -> r' -> r') -> r -> Trivial m r k k) -> Trivial m r r' a #

Stacked m => Stacked (Trivial m) Source # 
Instance details

Defined in Text.Pup.Class

Methods

shift_ :: ((r' -> r') -> r -> Trivial m r r'' r'') -> Trivial m r r' () #

Applicative (m r r') => Applicative (Trivial m r r') Source # 
Instance details

Defined in Text.Pup.Class

Methods

pure :: a -> Trivial m r r' a #

(<*>) :: Trivial m r r' (a -> b) -> Trivial m r r' a -> Trivial m r r' b #

liftA2 :: (a -> b -> c) -> Trivial m r r' a -> Trivial m r r' b -> Trivial m r r' c #

(*>) :: Trivial m r r' a -> Trivial m r r' b -> Trivial m r r' b #

(<*) :: Trivial m r r' a -> Trivial m r r' b -> Trivial m r r' a #

Functor (m r r') => Functor (Trivial m r r') Source # 
Instance details

Defined in Text.Pup.Class

Methods

fmap :: (a -> b) -> Trivial m r r' a -> Trivial m r r' b #

(<$) :: a -> Trivial m r r' b -> Trivial m r r' a #

Monad (m r r') => Monad (Trivial m r r') Source # 
Instance details

Defined in Text.Pup.Class

Methods

(>>=) :: Trivial m r r' a -> (a -> Trivial m r r' b) -> Trivial m r r' b #

(>>) :: Trivial m r r' a -> Trivial m r r' b -> Trivial m r r' b #

return :: a -> Trivial m r r' a #

Additive (m r r' a) => Additive (Trivial m r r' a) Source # 
Instance details

Defined in Text.Pup.Class

Methods

empty :: Trivial m r r' a #

(<|>) :: Trivial m r r' a -> Trivial m r r' a -> Trivial m r r' a #