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.
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
an error, usually constructed into an ErrorTree to provide the paths to the fields where the errors occurred
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
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)) }
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).
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
.
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
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] = ...
Validation and data transformation capabilities used in uniform.