Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Permissions for casts between wrappers and their inner types.
Synopsis
- class ToT s ~ ToT (Unwrappabled s) => Unwrappable (s :: Type) where
- type Unwrappabled s :: Type
- class Unwrappable s => Wrappable (s :: Type)
Documentation
class ToT s ~ ToT (Unwrappabled s) => Unwrappable (s :: Type) Source #
Declares that this type is just a wrapper over some other type and it can be safely unwrapped to that inner type.
Inspired by lens Wrapped
.
type Unwrappabled s :: Type Source #
The type we unwrap to (inner type of the newtype).
Used in constraint for Lorentz instruction wrapping into a Haskell newtype and vice versa.
type Unwrappabled s = GUnwrappabled s (Rep s)
Instances
class Unwrappable s => Wrappable (s :: Type) Source #
Declares that it is safe to wrap an inner type to the given
wrapper type. Can be provided in addition to Unwrappable
.
You can declare this instance when your wrapper exists just to
make type system differentiate the two types. Example:
newtype TokenId = TokenId Natural
.
Do not define this instance for wrappers that provide some invariants.
Example: UStore
type from morley-upgradeable
.
Wrappable
is similar to lens Wrapped
class without the method.
Instances
Wrappable (ParameterWrapper deriv cp) Source # | |
Defined in Lorentz.Entrypoints.Manual | |
Wrappable (NamedF Identity a name) Source # | |
Defined in Lorentz.Wrappable | |
Wrappable (NamedF Maybe a name) Source # | |
Defined in Lorentz.Wrappable |