JsonTuple

io.github.cakelier.tuples.space.JsonTuple$
See theJsonTuple companion trait
object JsonTuple

Companion object to the JsonTuple trait, containing its factory methods and its implementations.

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JsonTuple.type

Members list

Type members

Classlikes

final case class #:(h: JsonElement, t: JsonTuple) extends JsonTuple

A non-empty JSON tuple, representing a generic tuple containing at least one element.

A non-empty JSON tuple, representing a generic tuple containing at least one element.

This implementation represents a tuple with at least one element, which is built element by element exploiting the "constructor" operator. Because the JSON tuple is a recursively defined data structure, the at-least-one defined element must be the one in its head, while its tail can be a JsonNil, if the tuple contains exactly one element, or another non-empty JSON tuple otherwise. This enables the recursion of this data structure.

Value parameters

h

the head of this non-empty JSON tuple, which is its first element

t

the tail of this non-empty JSON tuple, which contains all the remaining elements in order

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait JsonTuple
class Object
trait Matchable
class Any
Show all
case object JsonNil extends JsonTuple

An empty JSON tuple, which could be seen also as a terminator for a JSON tuple definition.

An empty JSON tuple, which could be seen also as a terminator for a JSON tuple definition.

For all data structures recursively defined, this represents the "base case" of the recursive definition, the empty tuple which signals that no more elements needs to be expected. So it has a meaning used on its own, representing an empty tuple, but also can be used for ending a definition of a tuple with a syntax such as

val tuple = 0 #: true #: "hello" #: JsonNil

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait JsonTuple
class Object
trait Matchable
class Any
Show all
Self type
JsonNil.type

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply(): JsonTuple

Creates a new empty JSON tuple.

Creates a new empty JSON tuple.

Attributes

Creates a new non-empty JSON tuple consisting of only one element.

Creates a new non-empty JSON tuple consisting of only one element.

Value parameters

v

the element which is the one and only making this JSON tuple

Attributes

Returns

a new non-empty JSON tuple made only of one element

Creates a new JSON tuple given the variable number of elements passed to it. If no elements are passed, an empty JSON tuple is created, a non-empty JSON tuple otherwise.

Creates a new JSON tuple given the variable number of elements passed to it. If no elements are passed, an empty JSON tuple is created, a non-empty JSON tuple otherwise.

Value parameters

vs

the variable number of elements to be used for creating a new JSON tuple

Attributes

Returns

a new JSON tuple consisting of the given elements, in the same order they were passed

Creates a new JSON tuple from a Seq, keeping the same order of the elements as in the Seq. If an empty sequence is given, an empty tuple will be returned, a non-empty JSON tuple otherwise.

Creates a new JSON tuple from a Seq, keeping the same order of the elements as in the Seq. If an empty sequence is given, an empty tuple will be returned, a non-empty JSON tuple otherwise.

Value parameters

vs

the Seq which elements are to be used for building a new JSON tuple

Attributes

Returns

a new JSON tuple consisting of the same elements of the given Seq in the same order