NewsubtypeWrapped
monix.newtypes.NewsubtypeWrapped
abstract class NewsubtypeWrapped[Src] extends Newsubtype[Src]
Simple variant of Newsubtype that provides an apply builder.
Such newsubtypes are meant for simple wrappers that don't do any validation.
Usage:
type FullName = FullName.Type
object FullName extends NewsubtypeWrapped[String]
// Initializing
val name: FullName = FullName("Alexandru Nedelcu")
// No need to extract the value when a string is needed:
assert(name === "Alexandru Nedelcu")
// We can pattern-match too:
name match {
case FullName(nameStr) =>
assert(nameStr === "Alexandru Nedelcu")
}
Attributes
- Source
- NewWrapped.scala
- Graph
-
- Supertypes
Members list
In this article