| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Control.Monad.Borrow.Pure.Clone
Synopsis
- class Clone a where
- genericClone :: forall a (α :: Lifetime). GenericClone a => Share α a %1 -> BO α a
- newtype AsCopyable a = AsCopyable a
- class Clone1 (f :: Type -> Type) where
- clone1 :: forall f a (α :: Lifetime). (Clone1 f, Clone a) => Share α (f a) %1 -> BO α (f a)
- type GenericClone1 (f :: Type -> Type) = (Clone1 (Rep1 f), Generic1 f)
- genericLiftClone :: forall f a b (α :: Lifetime). GenericClone1 f => (Share α a %1 -> BO α b) -> Share α (f a) %1 -> BO α (f b)
- genericClone1 :: forall f a (α :: Lifetime). (GenericClone1 f, Clone a) => Share α (f a) %1 -> BO α (f a)
Documentation
is analogous o Clone a, but requires cloned values
to be accessible only inside the Copyable a monad.BO α
The difference between Clone and Copyable is that the former allows for
cloning a shared borrow of a mutable or linear value, while the latter requires cloning a shared borrow of an immutable value.
This is because we can leak via Share α aMovable instance, and
hence it can outlive the original lifetime, which allows leaking mutable states inside BO αa into unrestricted contexts, which destroys the soundness severly.
Minimal complete definition
Nothing
Instances
newtype AsCopyable a Source #
Constructors
| AsCopyable a |
Instances
| Copyable a => Clone (AsCopyable a) Source # | |
Defined in Control.Monad.Borrow.Pure.Clone Methods clone :: forall (α :: Lifetime). Share α (AsCopyable a) %1 -> BO α (AsCopyable a) Source # | |
| Copyable a => Copyable (AsCopyable a) Source # | |
Defined in Control.Monad.Borrow.Pure.Clone Methods copy :: forall (bk :: BorrowKind) (α :: Lifetime). Borrow bk α (AsCopyable a) %1 -> AsCopyable a Source # | |
class Clone1 (f :: Type -> Type) where Source #
Lifting of the Clone operation to unary type constructors.
Minimal complete definition
Nothing
Methods
liftClone :: forall (α :: Lifetime) a b. (Share α a %1 -> BO α b) -> Share α (f a) %1 -> BO α (f b) Source #
Instances
| Clone1 NonEmpty Source # | |
| Clone1 Par1 Source # | |
| Clone1 Maybe Source # | |
| Clone1 [] Source # | |
| Clone a => Clone1 (Either a) Source # | |
| Clone1 (Proxy :: Type -> Type) Source # | |
| Clone1 (U1 :: Type -> Type) Source # | |
| Clone1 (V1 :: Type -> Type) Source # | |
| Clone a => Clone1 ((,) a) Source # | |
| GenericClone1 f => Clone1 (Generically1 f) Source # | |
Defined in Control.Monad.Borrow.Pure.Clone Methods liftClone :: forall (α :: Lifetime) a b. (Share α a %1 -> BO α b) -> Share α (Generically1 f a) %1 -> BO α (Generically1 f b) Source # | |
| (Clone1 f, Clone1 g) => Clone1 (f :*: g) Source # | |
| (Clone1 f, Clone1 g) => Clone1 (f :+: g) Source # | |
| Clone a => Clone1 (K1 i a :: Type -> Type) Source # | |
| Clone1 f => Clone1 (M1 i c f) Source # | |
| (Clone1 f, Clone1 g) => Clone1 (f :.: g) Source # | |
clone1 :: forall f a (α :: Lifetime). (Clone1 f, Clone a) => Share α (f a) %1 -> BO α (f a) Source #
genericLiftClone :: forall f a b (α :: Lifetime). GenericClone1 f => (Share α a %1 -> BO α b) -> Share α (f a) %1 -> BO α (f b) Source #
genericClone1 :: forall f a (α :: Lifetime). (GenericClone1 f, Clone a) => Share α (f a) %1 -> BO α (f a) Source #