Printer

zio.parser.Printer
See thePrinter companion object
sealed trait Printer[+Err, +Out, -Value] extends VersionSpecificPrinter[Err, Out, Value]

A Printer takes a value of type 'Value' and either produces a stream of 'Out' elements and a result value of type 'Result', or fails with a custom error of type 'Err'.

Parsers can be combined with Printers to get Syntax, or a Parser and a Printer can be built simultaneously by using the combinators of Syntax.

Type parameters

Err

Custom error type

Out

Element type of the output stream of printing

Value

The type of the value to be printed

Attributes

Companion
object
Graph
Supertypes
trait VersionSpecificPrinter[Err, Out, Value]
class Object
trait Matchable
class Any
Known subtypes
class Contramap[Err, Err2, Out, Value2, Value]
class ContramapEither[Err, Err2, Out, Value2, Value]
class Fail[Err]
class Failed[Err]
class FlatMapValue[Err, Out, Value]
class Ignore[Err, Out, Value, Value2]
class Lazy[Err, Out, Value]
class MapError[Err, Err2, Out, Value]
class Optional[Err, Out, Value]
class OrElse[Err, Err2, Out, Out2, Value2, Value]
class OrElseEither[Err, Err2, Out, Out2, Value2, Value]
class ParseRegex[Err]
class ParseRegexLastChar[Err]
class Passthrough[Value, Result]
class ProvideValue[Err, Out, Value]
class Repeat[Err, Out, Value]
class SkipRegex
class Succeed
class Zip[Err, Err2, Out, Out2, Value2, Value, ZippedValue]
class ZipLeft[Err, Err2, Out, Out2, Value2, Value]
class ZipRight[Err, Err2, Out, Out2, Value2, Value]
Show all
Self type
Printer[Err, Out, Value]

Members list

Value members

Concrete methods

final def *: Printer[Err, Out, Chunk[Value]]

Symbolic alias for repeat0

Symbolic alias for repeat0

Attributes

final def +: Printer[Err, Out, Chunk[Value]]

Symbolic alias for repeat

Symbolic alias for repeat

Attributes

final def <+>[Err2 >: Err, Out2 >: Out, Value2](that: => Printer[Err2, Out2, Value2]): Printer[Err2, Out2, Either[Value, Value2]]

Symbolic alias for orElseEither

Symbolic alias for orElseEither

Attributes

final def <>[Err2 >: Err, Out2 >: Out, Value2 <: Value](that: => Printer[Err2, Out2, Value2]): Printer[Err2, Out2, Value2]

Symbolic alias for orElse

Symbolic alias for orElse

Attributes

final def <~[Err2 >: Err, Out2 >: Out](that: => Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Value]

Symbolic alias for zipLeft

Symbolic alias for zipLeft

Attributes

final def ?: Printer[Err, Out, Option[Value]]

Symbolic alias for optional

Symbolic alias for optional

Attributes

final def apply(value: Value): Printer[Err, Out, Any]

Provide this printer it's input value

Provide this printer it's input value

Attributes

final def asPrinted[Value2](matches: Value2, value: Value): Printer[Err, Out, Value2]

Ignores the printer's result and input and use 'result' and 'value' instead

Ignores the printer's result and input and use 'result' and 'value' instead

Attributes

final def between[Err2 >: Err, Out2 >: Out](left: Printer[Err2, Out2, Unit], right: Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Value]

Surround this printer with 'left' and 'right', each getting Unit as value to be printed.

Surround this printer with 'left' and 'right', each getting Unit as value to be printed.

Attributes

final def contramap[Value2](f: Value2 => Value): Printer[Err, Out, Value2]

Maps the printer's input value with function 'f'

Maps the printer's input value with function 'f'

Attributes

final def contramapEither[Err2, Value2](from: Value2 => Either[Err2, Value]): Printer[Err2, Out, Value2]

Maps the printer's result with function 'to' and its input value with 'from'. Both functions can fail the printer.

Maps the printer's result with function 'to' and its input value with 'from'. Both functions can fail the printer.

Attributes

final def contramapTo[Err2 >: Err, Value2](from: PartialFunction[Value2, Value], failure: Err2): Printer[Err2, Out, Value2]

Maps the result of the printer with the function 'to', and the value to be printed with the partial function 'from'. It the partial function is not defined on the value, the printer fails with 'failure'.

Maps the result of the printer with the function 'to', and the value to be printed with the partial function 'from'. It the partial function is not defined on the value, the printer fails with 'failure'.

This can be used to define separate syntaxes for subtypes, that can be later combined.

Attributes

final def filter[E2 >: Err, Value2 <: Value](condition: Value2 => Boolean, failure: E2): Printer[E2, Out, Value2]

Specifies a filter condition 'condition' that gets checked on both the printed and the result value and in case it evaluates to false, fails with 'failure'.

Specifies a filter condition 'condition' that gets checked on both the printed and the result value and in case it evaluates to false, fails with 'failure'.

Attributes

final def flatten(implicit ev1: Chunk[String] <:< Value): Printer[Err, Out, String]

Concatenates a chunk of string to be printed

Concatenates a chunk of string to be printed

Attributes

def from[Value2](implicit conversion: TupleConversion[Value2, Value]): Printer[Err, Out, Value2]
Implicitly added by TuplePrinterOps

Transforms the printer's input from a given case class for a tuple printer

Transforms the printer's input from a given case class for a tuple printer

Attributes

final def mapError[Err2](f: Err => Err2): Printer[Err2, Out, Value]

Maps the error with function 'f'

Maps the error with function 'f'

Attributes

final def optional: Printer[Err, Out, Option[Value]]

Print option values

Print option values

Attributes

final def orElse[Err2 >: Err, Out2 >: Out, Value2 <: Value](that: => Printer[Err2, Out2, Value2]): Printer[Err2, Out2, Value2]

Prints this and if it fails, ignore the printed output and print 'that' instead.

Prints this and if it fails, ignore the printed output and print 'that' instead.

Attributes

final def orElseEither[Err2 >: Err, Out2 >: Out, Value2](that: => Printer[Err2, Out2, Value2]): Printer[Err2, Out2, Either[Value, Value2]]

Prints this if the input is 'Left', or print 'that' if the input is 'Right'

Prints this if the input is 'Left', or print 'that' if the input is 'Right'

Attributes

final def printString(value: Value)(implicit ev: Out <:< Char): Either[Err, String]

Print the given 'value' to a string

Print the given 'value' to a string

Attributes

final def repeat: Printer[Err, Out, Chunk[Value]]

Repeats this printer for each element of the input chunk, assuming it has at least one element

Repeats this printer for each element of the input chunk, assuming it has at least one element

Attributes

final def repeat0: Printer[Err, Out, Chunk[Value]]

Repeats this printer for each element of the input chunk, zero or more times

Repeats this printer for each element of the input chunk, zero or more times

Attributes

final def repeatUntil[Err2 >: Err, Out2 >: Out](stopCondition: Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Chunk[Value]]

Repeat this printer for each element of the input chunk, verifying the 'stopConfition' after each.

Repeat this printer for each element of the input chunk, verifying the 'stopConfition' after each.

Attributes

final def repeatWithSep[Err2 >: Err, Out2 >: Out](sep: Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Chunk[Value]]

Repeats this printer for each element of the input chunk, separated by the 'sep' printer (which gets Unit to be printed)

Repeats this printer for each element of the input chunk, separated by the 'sep' printer (which gets Unit to be printed)

Attributes

final def repeatWithSep0[Err2 >: Err, Out2 >: Out](sep: Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Chunk[Value]]

Repeats this printer for each element of the input chunk that can be empty, separated by the 'sep' printer (which gets Unit to be printed)

Repeats this printer for each element of the input chunk that can be empty, separated by the 'sep' printer (which gets Unit to be printed)

Attributes

final def surroundedBy[Err2 >: Err, Out2 >: Out](other: Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Value]

Surround this printer with 'other', which will get Unit as value to be printed.

Surround this printer with 'other', which will get Unit as value to be printed.

Attributes

final def transformOption[Value2](from: Value2 => Option[Value]): Printer[Option[Err], Out, Value2]

Maps the printer's result with function 'to' and its input value with 'from'. Both functions can fail the printer. Failure is indicated by None on the error channel.

Maps the printer's result with function 'to' and its input value with 'from'. Both functions can fail the printer. Failure is indicated by None on the error channel.

Attributes

final def widenWith[Err2 >: Err, Value2](narrow: PartialFunction[Value2, Value], failure: Err2): Printer[Err2, Out, Value2]

Widen this printer's printed value type by specifying a partial function to narrow it back to the set of supported subtypes.

Widen this printer's printed value type by specifying a partial function to narrow it back to the set of supported subtypes.

Attributes

final def zip[Err2 >: Err, Out2 >: Out, Value2, ZippedValue](that: => Printer[Err2, Out2, Value2])(implicit unzippableValue: In[Value, Value2, ZippedValue]): Printer[Err2, Out2, ZippedValue]
Implicitly added by PrinterOps

Take a pair to be printed, print the left value with this, and the right value with 'that'. The result is a pair of both printer's results.

Take a pair to be printed, print the left value with this, and the right value with 'that'. The result is a pair of both printer's results.

Attributes

final def zipLeft[Err2 >: Err, Out2 >: Out](that: => Printer[Err2, Out2, Unit]): Printer[Err2, Out2, Value]

Print 'that' by providing the unit value to it after printing this. The result is this printer's result.

Print 'that' by providing the unit value to it after printing this. The result is this printer's result.

Attributes

def zipRight(that: => Printer[Err, Out, Value]): Printer[Err, Out, Value]
Implicitly added by PrinterOps

Print this, then print that and use the second printer's result value. Both printers get the same value to be printed.

Print this, then print that and use the second printer's result value. Both printers get the same value to be printed.

Attributes

def zipRight[Err2 >: Err, Out2 >: Out, Value](that: => Printer[Err2, Out2, Value]): Printer[Err2, Out2, Value]
Implicitly added by UnitPrinterOps

Print Unit with this, then print that and use the second printer's result value

Print Unit with this, then print that and use the second printer's result value

Attributes

final def |[Err2 >: Err, Out2 >: Out, Value2 <: Value](that: => Printer[Err2, Out2, Value2]): Printer[Err2, Out2, Value2]

Symbolic alias for orElse

Symbolic alias for orElse

Attributes

final def ~[Err2 >: Err, Out2 >: Out, Value2, ZippedValue](that: => Printer[Err2, Out2, Value2])(implicit zippableValue: In[Value, Value2, ZippedValue]): Printer[Err2, Out2, ZippedValue]
Implicitly added by PrinterOps

Symbolic alias for zip

Symbolic alias for zip

Attributes

def ~>(that: => Printer[Err, Out, Value]): Printer[Err, Out, Value]
Implicitly added by PrinterOps

Symbolic alias for zipRight

Symbolic alias for zipRight

Attributes

def ~>[Err2 >: Err, Out2 >: Out, Value](that: => Printer[Err2, Out2, Value]): Printer[Err2, Out2, Value]
Implicitly added by UnitPrinterOps

Symbolic alias for zipRight

Symbolic alias for zipRight

Attributes

Inherited methods

final def orElseU[Err2 >: Err, Out2 >: Out, Value1 <: Value, Value2 : ClassTag](that: => Printer[Err2, Out2, Value2])(implicit evidence$1: ClassTag[Value2], vtag: ClassTag[Value1]): Printer[Err2, Out2, Value1 | Value2]

Prints this and if it fails, ignore the printed output and print 'that' instead.

Prints this and if it fails, ignore the printed output and print 'that' instead.

Attributes

Inherited from:
VersionSpecificPrinter