sprout
package sprout
- Source
- package.scala
- Alphabetic
- By Inheritance
- sprout
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
Burry[O] extends AnyRef
Helper for various sprout constructors, because going from your new type to your old type is always the same.
Helper for various sprout constructors, because going from your new type to your old type is always the same.
This is extremely handy when defining various contravariant functor typeclasses, e.g. various encoders, ordering, etc.
-
trait
NewType[O, N] extends OldType[O, N]
The purpose of this type class is to give further application code a way to talk about this "new type" encoding.
The purpose of this type class is to give further application code a way to talk about this "new type" encoding. So that converting to and from the underlying type can be done with as little boilerplate as possible in inter-op with 3rd party libraries, and other classes.
- O
O for old type. i.e. the underlying runtime type
- N
N for new type. i.e. the type that ought to live only in the compiler
- See also
sprout.SproutShow as an example. We can easily provide a Show instance for N if the underlying representation has one. And it's opt in. This principle is then extended to a host of 3rd party libraries to eliminate boilerplate. See the sprout-interop github repo for many other examples.
-
trait
OldType[O, N] extends AnyRef
- See also
sprout.NewType This typeclass is usefull for defining the contravariant functors. e.g. io.circe.Encoder for your new types.
- trait RefinedType[O, N, E] extends OldType[O, N]
- type RefinedTypeThrow[O, N] = RefinedType[O, N, Throwable]
-
trait
Sprout[O] extends TagNewType[O] with Burry[O]
Intended to be mixed into an object, or in certain cases a class, for them to act as the containers and constructors for your new type.
Intended to be mixed into an object, or in certain cases a class, for them to act as the containers and constructors for your new type.
e.g.
object FirstName extends Sprout[String] type FirstName = FirstName.Type
- trait SproutEq[OT] extends AnyRef
- trait SproutOrder[OT] extends AnyRef
- trait SproutRefined[O, E] extends Burry[O] with TagNewType[O]
- trait SproutRefinedSub[O, E] extends Burry[O] with TagSubType[O]
- trait SproutRefinedThrow[O] extends SproutRefined[O, Throwable]
- trait SproutShow[OT] extends AnyRef
- trait SproutSub[O] extends Burry[O] with TagSubType[O]
- trait TagNewType[O] extends AnyRef
- trait TagSubType[O] extends AnyRef
Value Members
- object NewType
- object OldType
- object RefinedType
- object RefinedTypeThrow