provides the Generic mapping between the wrapper type and the wrapped
value type. Using a Repr
type of V :: HNil
proves that W
wraps
a single value of type V
a Validator
instance that will validate a value of type V
in the context
of a wrapper of type W
. The Validator
object provides a low-priority instance
which is an identity function (i.e. always validates successfully), which will
get picked up if you do not provide a higher-priority instance yourself.
This trait provides an implicit function that will generate a ValueWrapper[W,V] for a case class of type
W
that has a single member of typeV
. This uses Shapeless to summon aGeneric[W, V :: HNil]
to assist with the wrapping and unwrapping, so it will actually work with any typeW
that is record-like enough for Shapeless to handle.The
genWV
function also takes an implicitValidator[W,V]
that allows for some form of validation and manipulation of the value to be wrapped when constructing theW
instance.