Sequenced

name.rayrobdod.stringContextParserCombinator.typeclass.Sequenced
See theSequenced companion object
@FunctionalInterface
trait Sequenced[-A, -B, +Z]

Describes how to combine two adjacent values into one value

Below is example of defining and using a custom Sequenced:

import java.time._
import name.rayrobdod.stringContextParserCombinator.Interpolator.idInterpolators._
import name.rayrobdod.stringContextParserCombinator.typeclass.Sequenced

given Sequenced[LocalDate, LocalTime, LocalDateTime] with {
 def aggregate(date:LocalDate, time:LocalTime):LocalDateTime = date.atTime(time)
}

val dateParser:Interpolator[LocalDate] = ofType[LocalDate]
val timeParser:Interpolator[LocalTime] = ofType[LocalTime]
val p: Interpolator[LocalDateTime] = dateParser andThen timeParser

p.interpolate(StringContext("", "", ""), LocalDate.of(2001, 02, 03) :: LocalTime.of(04, 05, 06) :: Nil) // `2001-02-03T04:05:06`: LocalDateTime

Type parameters

A

the first input

B

the second input

Z

the result container

Attributes

See also
Companion
object
Source
Sequenced.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BiSequenced[A, B, Z]

Members list

Value members

Abstract methods

def aggregate(left: A, right: B): Z

Attributes

Source
Sequenced.scala