Package

ltbs

uniform

Permalink

package uniform

Linear Supertypes
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

Type Members

  1. type ::[H, T <: HList] = shapeless.::[H, T]

    Permalink
  2. type BigString = String with Tagged[BigStringTag]

    Permalink

    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

    Permalink

    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

    Permalink

    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]]

    Permalink
  6. trait IndexOf[L <: HList, U] extends DepFn1[L] with Serializable

    Permalink

    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]]

    Permalink
  8. type InputPath = List[String]

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

    Permalink

    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. class MapTree[K, V] extends TreeLike[Map[List[K], V]]

    Permalink
    Definition Classes
    TreeLikeInstances
  11. type NilTypes = shapeless.::[Unit, HNil]

    Permalink
  12. type NonEmptyString = String with Tagged[NonEmptyStringTag]

    Permalink
  13. trait NonEmptyStringTag extends AnyRef

    Permalink
  14. trait OptTCOps extends AnyRef

    Permalink
  15. class Rewriter[TC[_], SupportedTell <: HList, SupportedAsk <: HList] extends AnyRef

    Permalink

    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).

  16. implicit class RichAppOps[F[_], A] extends AnyRef

    Permalink
  17. implicit class RichEither[A, B] extends AnyRef

    Permalink
    Definition Classes
    ScalaVersionCompatibility
  18. implicit class RichErrorTree extends AnyRef

    Permalink
  19. implicit class RichInput extends AnyRef

    Permalink
  20. implicit class RichTry[A] extends AnyRef

    Permalink
    Definition Classes
    ScalaVersionCompatibility
  21. trait ScalaVersionCompatibility extends AnyRef

    Permalink
    Annotations
    @silent( "Unused import" )
  22. trait TreeLike[T] extends Serializable

    Permalink

    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( ... )
  23. trait TreeLikeInstances extends AnyRef

    Permalink
  24. trait TypeclassList[L <: HList, F[_]] extends AnyRef

    Permalink

    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( ... )
  25. trait UniformMessages[A] extends AnyRef

    Permalink

    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 object ErrorTree extends TreeLike[ErrorTree]

    Permalink
    Definition Classes
    TreeLikeInstances
  2. object IndexOf extends Serializable

    Permalink
  3. implicit object Input extends MapTree[String, List[String]]

    Permalink
  4. object NonEmptyString

    Permalink
  5. object OptTCSyntax extends OptTCOps

    Permalink
  6. object TreeLike extends Serializable

    Permalink
  7. object TypeclassList

    Permalink
  8. object UniformMessages

    Permalink
  9. implicit def monListMap[K, V](implicit arg0: Semigroup[V]): Monoid[ListMap[K, V]] { def empty: scala.collection.immutable.ListMap[K,Nothing] }

    Permalink
  10. def taggedEqInstance[A, Tag](eqBase: Eq[A]): Eq[@@[A, Tag]]

    Permalink
  11. 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} }

    Permalink
    Definition Classes
    ToTreeLikeOps
    Annotations
    @SuppressWarnings()
  12. package validation

    Permalink

    Validation and data transformation capabilities used in uniform.

Inherited from ScalaVersionCompatibility

Inherited from TreeLikeInstances

Inherited from ToTreeLikeOps

Inherited from AnyRef

Inherited from Any

Ungrouped