Type classes to enable convenient wrapping and unwrapping.
purescript-newtype it provides separation between things that can
wraped and those that can be only
unwraped. This provides extra
safety in contexts where you want to hide the
newtype constructor and
only expose constuctor functions that validate data before wrapping it
with a newtype.
In those scenarios, you want to be sure that data inside your newtype
is always valid and that only your custom constructors will be used to
create it, prohibiting invalid values from sneaking in.
If you only have a singular function that constructs your newtype then you
can still provide a sensible
Newtype by giving it your
custom constructor that validates data before wrapping it. In that case,
this package will not provide any extra value.
But if you have severa alternative constructor functions that all generate
the same newtype, then you can't supply a meaningful
This allows you to enjoy the convenience of the
unwrap without having to
wrap and vice versa.