Newsubtype
monix.newtypes.Newsubtype
Like Newtype, except as a subtype of the underlying type instead of as an entirely new type.
type Level = Level.Type
object Level extends NewsubtypeWrapped[Int]
val level1: Level = Level(1)
// This works too
val level2: Int = Level(2)
// This fails compilation
// val level3: Level = 3
Attributes
- Source
- Newsubtype.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class NewsubtypeValidated[Src]class NewsubtypeWrapped[Src]
Members list
In this article