Trait

ltbs.uniform

Language

Related Doc: package uniform

Permalink

trait Language[UF[_], SupportedTell <: HList, SupportedAsk <: HList] extends AnyRef

The core language of uniform, journeys will typically be expressed in terms of this interaction

import ltbs.uniform._
import scala.language.higherKinds

// the data types that the user can be presented with in a `tell'
type TellTypes = String :: Option[String] :: NilTypes

// the data types that the user can be prompted for in an `ask'
type AskTypes = Int :: Option[String] :: NilTypes

def program[F[_]: Monad](
  interpreter: Language[F, TellTypes, AskTypes]
): F[(Int, Option[String])] = {
  import interpreter._
  for {
    a <- interact[String,Int]("ask-a", "please provide a")
    b <- interact[String,Int]("ask-b", "please provide b")
    c <- ask[Option[String]]("c")
    _ <- tell[Option[String]]("d", c)
  } yield ((a + b, c))
}
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Language
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def interact[Tell, Ask](id: String, tell: Tell, default: Option[Ask] = None, validation: Rule[Ask] = Rule.alwaysPass[Ask], customContent: Map[String, (String, List[Any])] = Map.empty)(implicit selectorTell: IndexOf[SupportedTell, Tell], selectorAsk: IndexOf[SupportedAsk, Ask]): UF[Ask]

    Permalink

    Present an instance of Tell to the user, and ask for an instance of Ask.

    Present an instance of Tell to the user, and ask for an instance of Ask. Defines a 'step' in the user journey.

    val askAddr: UF[Address] =
      interpreter.interact[Address,Boolean](
        "confirm-address",
        someAddress
      )
    id

    step identifier - care should be taken to keep these distinct within a given journey

    tell

    data to be presented to the user

    default

    optional existing/default value. For example an 'edit' journey.

    validation

    rule to check the data is valid (after it has been turned into an Ask).

    customContent

    overrides any messages used in the journey step

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 ask[A](id: String, default: Option[A] = None, validation: Rule[A] = Rule.alwaysPass[A], customContent: Map[String, (String, List[Any])] = Map.empty)(implicit selectorAsk: IndexOf[SupportedAsk, A], selectorTell: IndexOf[SupportedTell, Unit]): UF[A]

    Permalink

    Ask the user for an instance of A.

    Ask the user for an instance of A. This is equivalent to interact[Unit, A]

    val askAddr: UF[Address] =
      interpreter.ask[Address]("delivery-address")
    id

    step identifier - care should be taken to keep these distinct within a given journey

    default

    optional existing/default value. For example an 'edit' journey.

    validation

    rules to check the data is valid (after it has been turned into an Ask).

    customContent

    overrides any messages used in the journey step

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def end[A](id: String, tellValue: A, customContent: Map[String, (String, List[Any])] = Map.empty)(implicit selectorAsk: IndexOf[SupportedAsk, Unit], selectorTell: IndexOf[SupportedTell, A], ufFunctor: Functor[UF]): UF[Nothing]

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

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

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

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

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

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

    Permalink
    Definition Classes
    Any
  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 subJourney[A](id: String*)(sub: ⇒ UF[A]): UF[A]

    Permalink

    Nest a journey within a single stage of a bigger journey.

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

    Permalink
    Definition Classes
    AnyRef
  19. def tell[A](id: String, tell: A, customContent: Map[String, (String, List[Any])] = Map.empty)(implicit selectorAsk: IndexOf[SupportedAsk, Unit], selectorTell: IndexOf[SupportedTell, A]): UF[Unit]

    Permalink

    Present the user with an instance of A.

    Present the user with an instance of A. This is equivalent to interact[A, Unit]

    val askAddr: UF[Unit] =
      interpreter.tell[OrderConfimation](
        "order-confirmation",
        myOrder.getConfirmation
      )
    id

    step identifier - care should be taken to keep these distinct within a given journey

    tell

    data to be presented to the user

    customContent

    overrides any messages used in the journey step

  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped