Packages

p

ltbs

uniform

package uniform

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. uniform
  2. ScalaVersionCompatibility
  3. TreeLikeInstances
  4. ToTreeLikeOps
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Package Members

  1. package validation

    Validation and data transformation capabilities used in uniform.

Type Members

  1. type ::[H, T <: HList] = shapeless.::[H, T]
  2. type BigString = String with Tagged[BigStringTag]

    Used to represent multi-line input.

    Used to represent multi-line input.

    Behaves identically to, and can be freely cast to, a String. However interpreters may decide to treat it differently - for example a web interpreter will usually render this a textarea or a cli interpreter may prompt for several lines.

  3. trait BigStringTag extends AnyRef

    Tagged type used to denote a string that could be more than a single line in some way.

    Tagged type used to denote a string that could be more than a single line in some way. For example creating a textarea rather than a string field

  4. case class ErrorMsg(msg: String, args: Any*) extends Product with Serializable

    an error, usually constructed into an ErrorTree to provide the paths to the fields where the errors occurred

  5. type ErrorTree = ListMap[NonEmptyList[InputPath], NonEmptyList[ErrorMsg]]
  6. trait IndexOf[L <: HList, U] extends DepFn1[L] with Serializable

    Allows the extraction of the position of the first occurance of an element in a HList.

    Allows the extraction of the position of the first occurance of an element in a HList.

    Part of the internal wiring of uniform's implementation of KLists, you are not likely to need this for your own journeys.

    import shapeless._
    import ltbs.uniform._
    
    the[IndexOf[Int :: String :: Boolean :: HNil, String]].index // 1
    the[IndexOf[String :: HNil, Boolean]] // compile error
    Annotations
    @implicitNotFound("Cannot find ${U} in ${L}")
  7. type Input = Map[InputPath, List[String]]
  8. type InputPath = List[String]
  9. trait Language[UF[_], SupportedTell <: HList, SupportedAsk <: HList] extends AnyRef

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

    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))
    }
  10. type NilTypes = shapeless.::[Unit, HNil]
  11. type NonEmptyString = String with Tagged[NonEmptyStringTag]
  12. trait NonEmptyStringTag extends AnyRef
  13. trait OptTCOps extends AnyRef
  14. class Rewriter[TC[_], SupportedTell <: HList, SupportedAsk <: HList] extends AnyRef

    Allows rewriting existing user journey without running them.

    Allows rewriting existing user journey without running them.

    This could be to optimise or otherwise transform a journey, for example to swap one type of interaction with another (such as a subjourney).

  15. implicit class RichAppOps[F[_], A] extends AnyRef
  16. implicit class RichErrorTree extends AnyRef
  17. implicit class RichInput extends AnyRef
  18. trait ScalaVersionCompatibility extends AnyRef
  19. trait TreeLike[T] extends Serializable

    Can be navigated like a tree.

    Can be navigated like a tree. Has a Value at branches and leaves, and edges are labelled with Key.

    Annotations
    @implicitNotFound("Could not find an instance of TreeLike for ${T}")
  20. trait TreeLikeInstances extends AnyRef
  21. class MapTree[K, V] extends TreeLike[Map[List[K], V]]
    Definition Classes
    TreeLikeInstances
  22. trait TypeclassList[L <: HList, F[_]] extends AnyRef

    A KList

    A KList

    For any F[_] and Hlist L of A :: B :: ... :: Z :: HNil provides a Repr of F[A] :: F[B] :: ... :: F[Z] :: HNil by looking for an implicit instance of each member in turn.

    import cats.Monoid, cats.implicits._
    import shapeless._
    val klist = TypeclassList[Int :: String :: HNil, Monoid]
    val stringMonoid = klist.forType[String].empty
    Annotations
    @implicitNotFound("Cannot find an implicit ${F}[_] for each type in ${L}")
  23. trait UniformMessages[A] extends AnyRef

    A content bundle

    A content bundle

    Typically used for internationalisation but also for customisation of content on given steps of a user-journey.

    This is modelled largely around the Messages object in the play framework - albeit with some extra capabilities (such as decomposition), but as such although it can take arguments (Any*)it is not typesafe and has no way of knowing ahead-of-time if content is missing.

    Unlike play Messages however, UniformMessages are typed, can be mapped to different types and are also Monoids allowing them to be combined.

    val m = UniformMessages.fromMap(
      Map("page1.field2.dateOfBirth" -> List("When were you born?"),
          "dateOfBirth" -> List("Date of birth"))
    )
    
    scala> m.get("page1.field2.dateOfBirth")
    res1: Option[String] = Some(When were you born?)
    
    scala> m.decomposeOpt("dateOfBirth")
    res2: Option[String] = Some(Date of birth)
    
    scala> import cats.implicits._
    scala> {m |+| UniformMessages.bestGuess}.apply("page1.step2.EnterYourBillingAddress")
    res3: String = Enter Your Billing Address
    
    scala> case class PoorMansHtml(value: String)
    defined class PoorMansHtml
    scala> m.map(PoorMansHtml)
    res4: ltbs.uniform.UniformMessages[PoorMansHtml] = ...

Value Members

  1. implicit def monListMap[K, V](implicit arg0: Semigroup[V]): Monoid[ListMap[K, V]] { def empty: scala.collection.immutable.ListMap[K,Nothing] }
  2. def taggedEqInstance[A, Tag](eqBase: Eq[A]): Eq[@@[A, Tag]]
  3. implicit def toTreeLikeOps[T](target: T)(implicit tc: TreeLike[T]): Ops[T] { type TypeClassType = ltbs.uniform.TreeLike[T]{type Key = tc.Key; type Value = tc.Value} }
    Definition Classes
    ToTreeLikeOps
    Annotations
    @SuppressWarnings()
  4. object IndexOf extends Serializable
  5. implicit object Input extends MapTree[String, List[String]]
  6. object NonEmptyString
  7. object OptTCSyntax extends OptTCOps
  8. object TreeLike extends Serializable
  9. implicit object ErrorTree extends TreeLike[ErrorTree]
    Definition Classes
    TreeLikeInstances
  10. object TypeclassList
  11. object UniformMessages

Inherited from TreeLikeInstances

Inherited from ToTreeLikeOps

Inherited from AnyRef

Inherited from Any

Ungrouped