trait MessageParser[A] extends AnyRef

MessageParser is a typeclass to simplify parsing messages. It can derive instances for any ADT, and makes it much easier to work with messages.

A

The type to parse.

Self Type
MessageParser[A]
Source
MessageParser.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MessageParser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def parse[F[_]](implicit c: CacheSnapshot, F: Monad[F], E: ApplicativeHandle[F, String], S: MonadState[F, List[String]]): F[A]

    A program to parse a message into the needed types.

Concrete Value Members

  1. def andThen[B](that: MessageParser[B]): MessageParser[(A, B)]

    Runs another parser after this one.

  2. def collectWithError[B](error: String)(pf: PartialFunction[A, B]): MessageParser[B]

    Apply a partial function of this parser, returning the error if the function isn't defined.

    Apply a partial function of this parser, returning the error if the function isn't defined.

    B

    The new parser type.

    error

    The error to return if the partial function isn't defined.

    pf

    The partial function to apply.

  3. def filterWithError(f: (A) => Boolean, error: String): MessageParser[A]

    Create a new parser by filtering the values created by this parser.

    Create a new parser by filtering the values created by this parser.

    f

    The predicate.

    error

    The error message if the value does not match the predicate.

  4. def orElse[B](that: MessageParser[B]): MessageParser[Either[A, B]]

    Try another parser if this one fails.

  5. def orElseWith[B, C](that: MessageParser[B])(f: (Either[A, B]) => C): MessageParser[C]

    Try another parser if this one fails, and combine their types.