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

Package Members

  1. package validation

    Validation and data transformation capabilities used in uniform.

Type Members

  1. case class AskListBuilder[A] extends Product with Serializable
  2. trait Converter[E[_], F[_], A] extends AnyRef

    Provides a mechanism to convert between two higher kinded types.

    Provides a mechanism to convert between two higher kinded types.

    This is commonly used to interleave other types into an interpreted uniform journey (for example API calls returning a Future[A] could be mapped to WebMonad[Html, A] in an interpretation targetting WebMonad[Html, *]).

    If the journey contains convert(x: E[A]) then there must be an implicit Converter[E, F, A] in scope when interpreting to the F higher kinded type.

    The most general way is to use a natural transformation E ~> F (from all possible A convert E[A] to F[A]), which will be implicitly converted into an Converter as needed

    The intermediate form is to use a function from E[A] => F[A], which is specific to the type A, and could differ from E[B] => F[B] in implementation. As with a natural transformation this will be converted as needed.

    The least general form is to extend Converter, this makes it possible to change the way the conversion is handled by key as well as by datatype.

    implicit val converter = new Converter[List, Option, Int] {
      def apply(key: String, in: () => List[Int]): Option[Int] =
        key match {
          case "reverse" => in().lastOption
          case _ => in().headOption
        }
    }
    Annotations
    @implicitNotFound()
  3. 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

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

    val errorTree = ErrorMsg("myform.myfield.badinput").toTree
  4. type ErrorTree = ListMap[NonEmptyList[InputPath], NonEmptyList[ErrorMsg]]
  5. type Input = Map[InputPath, List[String]]
  6. type InputPath = List[String]
  7. case class InteractBuilder[A] extends Product with Serializable
  8. trait Interpreter[F[_], INTERACTTC[_, _], ASKLISTTC[_]] extends AnyRef

    Maps a journey from its abstract form into a concrete one.

    Maps a journey from its abstract form into a concrete one.

    Must target a specific higher kinded type (for example, WebMonad).

    When creating your own interpreter you may be better served by inheriting MonadInterpreter as this already has some of the wiring

  9. class InterpreterMacros extends AnyRef
  10. trait MonadInterpreter[F[_], INTERACTTC[_, _], ASKLISTTC[_]] extends Interpreter[F, INTERACTTC, ASKLISTTC]
  11. sealed trait Needs[-T, +A] extends AnyRef
  12. trait Noop[A] extends AnyRef
  13. implicit class RichErrorTree extends AnyRef
  14. implicit final class RichInput extends AnyVal
  15. trait ScalaVersionCompatibility extends AnyRef
  16. 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()
  17. trait TreeLikeInstances extends AnyRef
  18. class MapTree[K, V] extends TreeLike[Map[List[K], V]]
    Definition Classes
    TreeLikeInstances
  19. trait Uniform[-R <: Needs[_, _], -T, +A] extends AnyRef
  20. 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. def ask[A](key: String, default: Option[A] = None, validation: Rule[A] = Rule.alwaysPass[A], customContent: Map[String, (String, List[Any])] = Map.empty)(implicit arg0: Tag[A]): Uniform[Interact[Unit, A], Unit, A]
  2. def askList[A](key: String, default: Option[List[A]] = None, validation: Rule[List[A]] = Rule.alwaysPass[List[A]]): AskListBuilder[A]
  3. def convert[F[_], A](action: => F[A])(implicit tagF: TagK[F], tagA: Tag[A]): Uniform[Convert[F, A], Unit, A]
  4. def convertWithKey[F[_], A](key: String)(action: => F[A])(implicit tagF: TagK[F], tagA: Tag[A]): Uniform[Convert[F, A], Unit, A]
  5. def end(key: String): Uniform[Interact[Unit, Nothing], Unit, Nothing]
  6. def end[A](key: String, value: A)(implicit arg0: Tag[A]): Uniform[Interact[A, Nothing], A, Nothing]
  7. def end(key: String, customContent: Map[String, (String, List[Any])]): Uniform[Interact[Unit, Nothing], Unit, Nothing]
  8. def end[T](key: String, value: T, customContent: Map[String, (String, List[Any])])(implicit arg0: Tag[T]): Uniform[Interact[T, Nothing], T, Nothing]
  9. def interact[A]: InteractBuilder[A]
  10. implicit def monListMap[K, V](implicit arg0: Semigroup[V]): Monoid[ListMap[K, V]] { def empty: scala.collection.immutable.ListMap[K,Nothing] }
  11. def nonReturn(key: String, hard: Boolean = true): NonReturn
  12. def pure[A](value: A): Uniform[Needs[_, _], Any, A]
  13. def subJourney[R <: Needs[_, _], T, A](pathHead: String, pathTail: String*)(base: Uniform[R, T, A]): Uniform[R, T, A]
  14. def tell[T](key: String, value: T, customContent: Map[String, (String, List[Any])] = Map.empty)(implicit arg0: Tag[T]): Uniform[Interact[T, Unit], T, Unit]
  15. 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()
  16. object Converter
  17. implicit object Input extends MapTree[String, List[String]]
  18. object Needs
  19. object Noop
  20. object TreeLike extends Serializable
  21. implicit object ErrorTree extends TreeLike[ErrorTree]
    Definition Classes
    TreeLikeInstances
  22. object Uniform
  23. object UniformMessages

Inherited from TreeLikeInstances

Inherited from ToTreeLikeOps

Inherited from AnyRef

Inherited from Any

Ungrouped