Object/Trait

info.hupel.isabelle

Codec

Related Docs: trait Codec | package isabelle

Permalink

object Codec

Combinators for codecs.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Codec
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class Variant[A] extends Codec[A]

    Permalink

    Template for a codec for a sum type A.

    Template for a codec for a sum type A.

    Each constructor of A should get assigned a unique index when implementing this class. It is used to tag XML trees, so that the correct decoding function can be chosen.

    In addition to the contract of Codec, instances of this class must also preserve the index, that is, any index returned by enc must produce a valid decoding function in dec.

    Using this is simple: Instead of creating a new Codec object, create an object extending from this class and implement enc and dec accordingly. It is automatically a Codec.

    Example usage

    new Variant[Option[A]]("option") {
      def enc(a: Option[A]) = a match {
        case Some(a) => (0, Codec[A].encode(a))
        case None    => (1, Codec[Unit].encode(()))
      }
      def dec(idx: Int) = idx match {
        case 0 => Some(Codec[A].decode(_).right.map(Some.apply))
        case 1 => Some(Codec[Unit].decode(_).right.map(_ => None))
        case _ => None
      }
    }

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply[A](implicit A: Codec[A]): Codec[A]

    Permalink

    Obtain an instance of a codec from the implicit scope.

    Obtain an instance of a codec from the implicit scope.

    Example usage

    Codec[Int].encode(env)(3)
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. implicit def boolean: Codec[Boolean]

    Permalink
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. implicit def either[A, B](implicit arg0: Codec[A], arg1: Codec[B]): Codec[Either[A, B]]

    Permalink
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. implicit def integer: Codec[BigInt]

    Permalink
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. implicit def list[A](implicit arg0: Codec[A]): Codec[List[A]]

    Permalink
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. implicit def option[A](implicit arg0: Codec[A]): Codec[Option[A]]

    Permalink
  21. implicit def string: Codec[String]

    Permalink
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  24. implicit def tree: Codec[Tree]

    Permalink
  25. implicit def triple[A, B, C](implicit arg0: Codec[A], arg1: Codec[B], arg2: Codec[C]): Codec[(A, B, C)]

    Permalink
  26. implicit def tuple[A, B](implicit arg0: Codec[A], arg1: Codec[B]): Codec[(A, B)]

    Permalink
  27. implicit def unit: Codec[Unit]

    Permalink
  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped