| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Unrestricted.Internal.Movable
Contents
Movable
class Dupable a => Movable a where Source #
Use to represent a type which can be used many times even
when given linearly. Simple data types such as Movable aBool or [] are Movable.
Though, bear in mind that this typically induces a deep copy of the value.
Formally, is the class of
coalgebras of the
Movable aUr comonad. That is
unur (move x) = x
- @move @(Ur a) (move @a x) = fmap (move @a) $ move @a x
Additionally, a Movable instance must be compatible with its Dupable parent instance. That is:
case move x of {Ur _ -> ()} = consume xcase move x of {Ur x -> (x, x)} = dup2 x
Instances
| Movable Bool Source # | |
| Movable Char Source # | |
| Movable Double Source # | |
| Movable Int Source # | |
| Movable Ordering Source # | |
| Movable () Source # | |
Defined in Data.Unrestricted.Internal.Instances | |
| Movable Any Source # | |
| Movable All Source # | |
| Movable a => Movable [a] Source # | |
Defined in Data.Unrestricted.Internal.Instances | |
| Movable a => Movable (Maybe a) Source # | |
| Movable a => Movable (Sum a) Source # | |
| Movable a => Movable (Product a) Source # | |
| Movable a => Movable (NonEmpty a) Source # | |
| Movable (Ur a) Source # | |
| (Movable a, Movable b) => Movable (Either a b) Source # | |
| (Movable a, Movable b) => Movable (a, b) Source # | |
Defined in Data.Unrestricted.Internal.Instances | |
| (Movable a, Movable b, Movable c) => Movable (a, b, c) Source # | |
Defined in Data.Unrestricted.Internal.Instances | |