package uniform
- Alphabetic
- By Inheritance
- uniform
- ScalaVersionCompatibility
- TreeLikeInstances
- ToTreeLikeOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Package Members
- package validation
Validation and data transformation capabilities used in uniform.
Type Members
- type ::[H, T <: HList] = shapeless.::[H, T]
- 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.
- 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
- 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
- type ErrorTree = ListMap[NonEmptyList[InputPath], NonEmptyList[ErrorMsg]]
- 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}")
- type Input = Map[InputPath, List[String]]
- type InputPath = List[String]
- 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)) }
- type NilTypes = shapeless.::[Unit, HNil]
- type NonEmptyString = String with Tagged[NonEmptyStringTag]
- trait NonEmptyStringTag extends AnyRef
- trait OptTCOps extends AnyRef
- 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).
- implicit class RichAppOps[F[_], A] extends AnyRef
- implicit class RichErrorTree extends AnyRef
- implicit class RichInput extends AnyRef
- trait ScalaVersionCompatibility extends AnyRef
- 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 withKey
.- Annotations
- @implicitNotFound("Could not find an instance of TreeLike for ${T}")
- trait TreeLikeInstances extends AnyRef
- class MapTree[K, V] extends TreeLike[Map[List[K], V]]
- Definition Classes
- TreeLikeInstances
- trait TypeclassList[L <: HList, F[_]] extends AnyRef
A KList
A KList
For any
F[_]
and HlistL
ofA :: B :: ... :: Z :: HNil
provides aRepr
ofF[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}")
- 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
- implicit def monListMap[K, V](implicit arg0: Semigroup[V]): Monoid[ListMap[K, V]] { def empty: scala.collection.immutable.ListMap[K,Nothing] }
- def taggedEqInstance[A, Tag](eqBase: Eq[A]): Eq[@@[A, Tag]]
- 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()
- object IndexOf extends Serializable
- implicit object Input extends MapTree[String, List[String]]
- object NonEmptyString
- object OptTCSyntax extends OptTCOps
- object TreeLike extends Serializable
- implicit object ErrorTree extends TreeLike[ErrorTree]
- Definition Classes
- TreeLikeInstances
- object TypeclassList
- object UniformMessages