Extract and return the value of type V
from the instance of W
Attempt to wrap the value v
in an instance of type 'W' and return it as a Right
.
Attempt to wrap the value v
in an instance of type 'W' and return it as a Right
.
If v
is somehow inappropriate to be wrapped then return an error message in
a Left
ValueWrapper
is a typeclass that abstracts the creation of a class that wraps a single value of another type, as well as the action of extracting the wrapped value from the wrapper. For example, for a single-member case class thewrap
method would use the companion objectapply
method to construct an instance and the accessor for the member to extract the wrapped value.the type of the wrapper
the type of the wrapped value