Trait/Object

info.hupel.isabelle

Codec

Related Docs: object Codec | package isabelle

Permalink

trait Codec[T] extends AnyRef

A type class representing the ability to convert a type to and from an XML representation.

For combinators to create codecs, refer to the companion object.

Contract

Instances of this class must satisfy the following contract: Decoding any value produced via encode must succeed, yielding the original value. The mlType field must contain a string representation of the corresponding type in Isabelle/ML.

For the opposite direction, it is generally expected that a value which cannot be produced via encode should not decode cleanly. This is generally achieved by adding tags to the trees. For example, if the codec for type Foo for a given value would produce an XML document t before tagging, the XML document after tagging would be <tag name="foo">t</tag>. The tagged method transforms a raw codec into a tagged codec. Nested tags are allowed (for example, when chaining multiple calls of tagged), but produce additional overhead in the resulting XML documents.

Self Type
Codec[T]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Codec
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def decode(tree: Tree): XMLResult[T]

    Permalink

    Decode a value from an XML tree, or produce an error.

    Decode a value from an XML tree, or produce an error.

    See also

    XMLResult

  2. abstract def encode(t: T): Tree

    Permalink

    Encode a value into an XML tree.

    Encode a value into an XML tree.

    You may want to use one of the two constructors elem and text.

  3. abstract val mlType: String

    Permalink

    String representation of the type corresponding to T in Isabelle/ML.

Concrete 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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def decodeOrThrow(tree: Tree): T

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. def list: Codec[List[T]]

    Permalink

    Codec for a list of Ts, tagged with the string list.

  14. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  17. def ptransform[U](f: (T) ⇒ Option[U], g: (U) ⇒ T, mlType0: String): Codec[U]

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

    Permalink
    Definition Classes
    AnyRef
  19. def tagged(tag: String): Codec[T]

    Permalink

    Create an identical codec which adds (or expects, respectively) an additional top-level tag.

    Create an identical codec which adds (or expects, respectively) an additional top-level tag.

    The given tag can be anything acceptable as an XML attribute value, but should be globally unique. That is, no other codec should have the same tag. It is fine if there are multiple codecs for a type, as long as their tags are distinct, although that is not a requirement.

  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. def transform[U](f: (T) ⇒ U, g: (U) ⇒ T, mlType0: String): Codec[U]

    Permalink

    Transform a codec for a type T into a codec for a type U by applying one of the two specified conversions.

    Transform a codec for a type T into a codec for a type U by applying one of the two specified conversions.

    After creating a new instance using transform, it is recommended to add a new tag.

  22. def tuple[U](that: Codec[U]): Codec[(T, U)]

    Permalink

    Codec for a pair of T and U, tagged with the string tuple.

  23. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped