Copyright  (c) Justin Le 2020 

License  BSD3 
Maintainer  justin@jle.im 
Stability  experimental 
Portability  nonportable 
Safe Haskell  None 
Language  Haskell2010 
Provides Ref
instances for various data types, as well as automatic
derivation of instances. See Data.Mutable for more information.
Synopsis
 newtype RecRef m f a = RecRef {}
 data HListRef :: (Type > Type) > [Type] > Type where
 newtype GRef m a = GRef {}
 gThawRef :: (Generic a, GMutable m (Rep a)) => a > m (GRef m a)
 gFreezeRef :: (Generic a, GMutable m (Rep a)) => GRef m a > m a
 gCopyRef :: (Generic a, GMutable m (Rep a)) => GRef m a > a > m ()
 gMoveRef :: GMutable m (Rep a) => GRef m a > GRef m a > m ()
 gCloneRef :: GMutable m (Rep a) => GRef m a > m (GRef m a)
 gUnsafeThawRef :: (Generic a, GMutable m (Rep a)) => a > m (GRef m a)
 gUnsafeFreezeRef :: (Generic a, GMutable m (Rep a)) => GRef m a > m a
 class Monad m => GMutable m f where
 thawHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z Identity > m (z (RefFor m))
 freezeHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > m (z Identity)
 copyHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > z Identity > m ()
 moveHKD :: forall z m. (Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > z (RefFor m) > m ()
 cloneHKD :: forall z m. (Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > m (z (RefFor m))
 unsafeThawHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z Identity > m (z (RefFor m))
 unsafeFreezeHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > m (z Identity)
 newtype CoerceRef m s a = CoerceRef {
 getCoerceRef :: Ref m a
 thawCoerce :: (Coercible s a, Mutable m a) => s > m (CoerceRef m s a)
 freezeCoerce :: (Coercible s a, Mutable m a) => CoerceRef m s a > m s
 copyCoerce :: (Coercible s a, Mutable m a) => CoerceRef m s a > s > m ()
 moveCoerce :: Mutable m a => CoerceRef m s a > CoerceRef m s a > m ()
 cloneCoerce :: Mutable m a => CoerceRef m s a > m (CoerceRef m s a)
 unsafeThawCoerce :: (Coercible s a, Mutable m a) => s > m (CoerceRef m s a)
 unsafeFreezeCoerce :: (Coercible s a, Mutable m a) => CoerceRef m s a > m s
 newtype TraverseRef m f a = TraverseRef {
 getTraverseRef :: f (Ref m a)
 thawTraverse :: (Traversable f, Mutable m a) => f a > m (TraverseRef m f a)
 freezeTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > m (f a)
 copyTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > f a > m ()
 moveTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > TraverseRef m f a > m ()
 cloneTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > m (TraverseRef m f a)
 unsafeThawTraverse :: (Traversable f, Mutable m a) => f a > m (TraverseRef m f a)
 unsafeFreezeTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > m (f a)
 newtype ImmutableRef a = ImmutableRef {
 getImmutableRef :: a
 thawImmutable :: Applicative m => a > m (ImmutableRef a)
 freezeImmutable :: Applicative m => ImmutableRef a > m a
 copyImmutable :: Applicative m => ImmutableRef a > a > m ()
 newtype GMutableRef m f a = GMutableRef {
 getGMutableRef :: GRef_ m f a
 newtype MutSumF m f g a = MutSumF {
 getMutSumF :: MutVar (PrimState m) ((f :+: g) a)
 type family MapRef m as where ...
Documentation
Instances
Eq (Ref m (f a)) => Eq (RecRef m f a) Source #  
Ord (Ref m (f a)) => Ord (RecRef m f a) Source #  
Defined in Data.Mutable.Instances 
data HListRef :: (Type > Type) > [Type] > Type where Source #
The mutable reference of the HList
type from genericlens.
Generic
Automatically generate a piecewise mutable reference for any Generic
instance.
  anyGeneric
instance data MyType = MyType { mtInt :: Int, mtDouble :: Double } deriving (Generic, Show) instance Mutable m MyType where type Ref m MyType =GRef
m MyType
ghci> r <thawRef
(MyType 3 4.5) ghci>freezeRef
r MyType 3 4.5 ghci>freezePart
(fieldMut
#mtInt) r 3 ghci>copyPart
(fieldMut #mtDouble) 1.23 ghci> freezeRef r MyType 3 1.23
Note that this is basically just a bunch of tupled refs for a product type. For a sum type (with multiple constructors), an extra layer of indirection is added to account for the dynamically changable shape.
See Data.Mutable.Parts and Data.Mutable.Branches for nice ways to inspect and mutate the internals of this type (as demonstrated above).
If the facilities in those modules are not adequate, you can also
manually crack open GRef
and work with the internals. Getting the
type of
should allow you to navigate what is going
on, if you are familiar with GHC.Generics. However, ideally, you
would never need to do this.unGRef
@MyType
Instances
(Generic a, GMutable m (Rep a)) => DefaultMutable m a (GRef m a) Source #  
Defined in Data.Mutable.Internal defaultThawRef :: a > m (GRef m a) Source # defaultFreezeRef :: GRef m a > m a Source # defaultCopyRef :: GRef m a > a > m () Source # defaultMoveRef :: GRef m a > GRef m a > m () Source # defaultCloneRef :: GRef m a > m (GRef m a) Source # defaultUnsafeThawRef :: a > m (GRef m a) Source # defaultUnsafeFreezeRef :: GRef m a > m a Source #  
Eq (GRef_ m (Rep a) ()) => Eq (GRef m a) Source #  
Ord (GRef_ m (Rep a) ()) => Ord (GRef m a) Source #  
Defined in Data.Mutable.Internal 
gThawRef :: (Generic a, GMutable m (Rep a)) => a > m (GRef m a) Source #
gFreezeRef :: (Generic a, GMutable m (Rep a)) => GRef m a > m a Source #
gCopyRef :: (Generic a, GMutable m (Rep a)) => GRef m a > a > m () Source #
gMoveRef :: GMutable m (Rep a) => GRef m a > GRef m a > m () Source #
gCloneRef :: GMutable m (Rep a) => GRef m a > m (GRef m a) Source #
gUnsafeThawRef :: (Generic a, GMutable m (Rep a)) => a > m (GRef m a) Source #
Default unsafeThawRef
for GRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with GRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the GRef
m aRef
class. See documentation
for GRef
for more information.
gUnsafeFreezeRef :: (Generic a, GMutable m (Rep a)) => GRef m a > m a Source #
Default unsafeFreezeRef
for GRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with GRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the GRef
m aRef
class. See documentation
for GRef
for more information.
class Monad m => GMutable m f Source #
gThawRef_, gFreezeRef_, gCopyRef_, gMoveRef_, gCloneRef_, gUnsafeThawRef_, gUnsafeFreezeRef_
Instances
Monad m => GMutable m (V1 :: k > Type) Source #  
Defined in Data.Mutable.Internal gThawRef_ :: forall (a :: k0). V1 a > m (GRef_ m V1 a) gFreezeRef_ :: forall (a :: k0). GRef_ m V1 a > m (V1 a) gCopyRef_ :: forall (a :: k0). GRef_ m V1 a > V1 a > m () gMoveRef_ :: forall (a :: k0). GRef_ m V1 a > GRef_ m V1 a > m () gCloneRef_ :: forall (a :: k0). GRef_ m V1 a > m (GRef_ m V1 a) gUnsafeThawRef_ :: forall (a :: k0). V1 a > m (GRef_ m V1 a) gUnsafeFreezeRef_ :: forall (a :: k0). GRef_ m V1 a > m (V1 a)  
Monad m => GMutable m (U1 :: k > Type) Source #  
Defined in Data.Mutable.Internal gThawRef_ :: forall (a :: k0). U1 a > m (GRef_ m U1 a) gFreezeRef_ :: forall (a :: k0). GRef_ m U1 a > m (U1 a) gCopyRef_ :: forall (a :: k0). GRef_ m U1 a > U1 a > m () gMoveRef_ :: forall (a :: k0). GRef_ m U1 a > GRef_ m U1 a > m () gCloneRef_ :: forall (a :: k0). GRef_ m U1 a > m (GRef_ m U1 a) gUnsafeThawRef_ :: forall (a :: k0). U1 a > m (GRef_ m U1 a) gUnsafeFreezeRef_ :: forall (a :: k0). GRef_ m U1 a > m (U1 a)  
(GMutable m f, GMutable m g) => GMutable m (f :*: g :: k > Type) Source #  
Defined in Data.Mutable.Internal gThawRef_ :: forall (a :: k0). (f :*: g) a > m (GRef_ m (f :*: g) a) gFreezeRef_ :: forall (a :: k0). GRef_ m (f :*: g) a > m ((f :*: g) a) gCopyRef_ :: forall (a :: k0). GRef_ m (f :*: g) a > (f :*: g) a > m () gMoveRef_ :: forall (a :: k0). GRef_ m (f :*: g) a > GRef_ m (f :*: g) a > m () gCloneRef_ :: forall (a :: k0). GRef_ m (f :*: g) a > m (GRef_ m (f :*: g) a) gUnsafeThawRef_ :: forall (a :: k0). (f :*: g) a > m (GRef_ m (f :*: g) a) gUnsafeFreezeRef_ :: forall (a :: k0). GRef_ m (f :*: g) a > m ((f :*: g) a)  
Mutable m c => GMutable m (K1 i c :: k > Type) Source #  
Defined in Data.Mutable.Internal gThawRef_ :: forall (a :: k0). K1 i c a > m (GRef_ m (K1 i c) a) gFreezeRef_ :: forall (a :: k0). GRef_ m (K1 i c) a > m (K1 i c a) gCopyRef_ :: forall (a :: k0). GRef_ m (K1 i c) a > K1 i c a > m () gMoveRef_ :: forall (a :: k0). GRef_ m (K1 i c) a > GRef_ m (K1 i c) a > m () gCloneRef_ :: forall (a :: k0). GRef_ m (K1 i c) a > m (GRef_ m (K1 i c) a) gUnsafeThawRef_ :: forall (a :: k0). K1 i c a > m (GRef_ m (K1 i c) a) gUnsafeFreezeRef_ :: forall (a :: k0). GRef_ m (K1 i c) a > m (K1 i c a)  
(GMutable m f, GMutable m g, PrimMonad m) => GMutable m (f :+: g :: k > Type) Source #  
Defined in Data.Mutable.Internal gThawRef_ :: forall (a :: k0). (f :+: g) a > m (GRef_ m (f :+: g) a) gFreezeRef_ :: forall (a :: k0). GRef_ m (f :+: g) a > m ((f :+: g) a) gCopyRef_ :: forall (a :: k0). GRef_ m (f :+: g) a > (f :+: g) a > m () gMoveRef_ :: forall (a :: k0). GRef_ m (f :+: g) a > GRef_ m (f :+: g) a > m () gCloneRef_ :: forall (a :: k0). GRef_ m (f :+: g) a > m (GRef_ m (f :+: g) a) gUnsafeThawRef_ :: forall (a :: k0). (f :+: g) a > m (GRef_ m (f :+: g) a) gUnsafeFreezeRef_ :: forall (a :: k0). GRef_ m (f :+: g) a > m ((f :+: g) a)  
GMutable m f => GMutable m (M1 i c f :: k > Type) Source #  
Defined in Data.Mutable.Internal gThawRef_ :: forall (a :: k0). M1 i c f a > m (GRef_ m (M1 i c f) a) gFreezeRef_ :: forall (a :: k0). GRef_ m (M1 i c f) a > m (M1 i c f a) gCopyRef_ :: forall (a :: k0). GRef_ m (M1 i c f) a > M1 i c f a > m () gMoveRef_ :: forall (a :: k0). GRef_ m (M1 i c f) a > GRef_ m (M1 i c f) a > m () gCloneRef_ :: forall (a :: k0). GRef_ m (M1 i c f) a > m (GRef_ m (M1 i c f) a) gUnsafeThawRef_ :: forall (a :: k0). M1 i c f a > m (GRef_ m (M1 i c f) a) gUnsafeFreezeRef_ :: forall (a :: k0). GRef_ m (M1 i c f) a > m (M1 i c f a) 
HigherKinded Data Pattern
thawHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z Identity > m (z (RefFor m)) Source #
Default thawRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
freezeHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > m (z Identity) Source #
Default freezeRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
copyHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > z Identity > m () Source #
Default copyRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
moveHKD :: forall z m. (Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > z (RefFor m) > m () Source #
Default moveRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
cloneHKD :: forall z m. (Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > m (z (RefFor m)) Source #
Default cloneRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
unsafeThawHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z Identity > m (z (RefFor m)) Source #
Default unsafeThawRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
unsafeFreezeHKD :: forall z m. (Generic (z Identity), Generic (z (RefFor m)), GMutable m (Rep (z Identity)), GRef_ m (Rep (z Identity)) ~ Rep (z (RefFor m))) => z (RefFor m) > m (z Identity) Source #
Default unsafeFreezeRef
for the higherkinded data pattern, a la
https://reasonablypolymorphic.com/blog/higherkindeddata/.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with z (
as the RefFor
m)Ref
.
However, it can be useful if you are using a z (
just as
a normal data type, independent of the RefFor
m)Ref
class. See documentation
for Mutable
for more information.
Coercible
newtype CoerceRef m s a Source #
A Ref
that works by using the Mutable
instance of an equivalent
type. This is useful for newtype wrappers, so you can use the
underlying data type's Mutable
instance.
newtype MyVec = MyVec (Vector
Double) instanceMutable
m MyVec where typeRef
m MyVec =CoerceRef
m s (Vector
Double)
The Ref m MyVec
uses the a
under the hood.MVector
Double
It's essentially a special case of GRef
for newtypes.
CoerceRef  

Instances
thawCoerce :: (Coercible s a, Mutable m a) => s > m (CoerceRef m s a) Source #
Default thawRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
freezeCoerce :: (Coercible s a, Mutable m a) => CoerceRef m s a > m s Source #
Default freezeRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
copyCoerce :: (Coercible s a, Mutable m a) => CoerceRef m s a > s > m () Source #
Default copyRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
moveCoerce :: Mutable m a => CoerceRef m s a > CoerceRef m s a > m () Source #
Default moveRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
cloneCoerce :: Mutable m a => CoerceRef m s a > m (CoerceRef m s a) Source #
Default cloneRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
unsafeThawCoerce :: (Coercible s a, Mutable m a) => s > m (CoerceRef m s a) Source #
Default unsafeThawRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
unsafeFreezeCoerce :: (Coercible s a, Mutable m a) => CoerceRef m s a > m s Source #
Default unsafeFreezeRef
for CoerceRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with CoerceRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the CoerceRef
m s aRef
class. See documentation
for CoerceRef
for more information.
Traversable
newtype TraverseRef m f a Source #
A Ref
that works for any instance of Traversable
, by using the
fields of the Traversable
instance to purely store mutable references.
Note that this really only makes complete sense if the Traversable
is
fixedsize, or you never modify the length of the traversable as you use
it as a reference.
If you do modify the length, copying and modifying semantics can be a bit funky:
 If copying a shorter item into a longer item ref, the "leftovers" items in the longer item are unchanged.
 If copying a longer item into a shorter item ref, the leftover items are unchanged.
ghci> r <thawTraverse
[1..10] ghci>copyTraverse
r [0,0,0,0] ghci>freezeTraverse
r [0,0,0,0,5,6,7,8,9,10] ghci>copyTraverse
r [20..50] ghci>freezeTraverse
r [20,21,22,23,24,25,26,27,28,29]
TraverseRef  

Instances
(Traversable f, Mutable m a) => DefaultMutable m (f a) (TraverseRef m f a) Source #  
Defined in Data.Mutable.Internal defaultThawRef :: f a > m (TraverseRef m f a) Source # defaultFreezeRef :: TraverseRef m f a > m (f a) Source # defaultCopyRef :: TraverseRef m f a > f a > m () Source # defaultMoveRef :: TraverseRef m f a > TraverseRef m f a > m () Source # defaultCloneRef :: TraverseRef m f a > m (TraverseRef m f a) Source # defaultUnsafeThawRef :: f a > m (TraverseRef m f a) Source # defaultUnsafeFreezeRef :: TraverseRef m f a > m (f a) Source #  
IsoHKD (TraverseRef m f :: Type > Type) (a :: Type) Source #  Use a 
Defined in Data.Mutable.Internal type HKD (TraverseRef m f) a # unHKD :: HKD (TraverseRef m f) a > TraverseRef m f a # toHKD :: TraverseRef m f a > HKD (TraverseRef m f) a #  
type HKD (TraverseRef m f :: Type > Type) (a :: Type) Source #  
Defined in Data.Mutable.Internal 
thawTraverse :: (Traversable f, Mutable m a) => f a > m (TraverseRef m f a) Source #
Default thawRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
freezeTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > m (f a) Source #
Default freezeRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
copyTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > f a > m () Source #
Default copyRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
:: (Traversable f, Mutable m a)  
=> TraverseRef m f a  destination 
> TraverseRef m f a  source 
> m () 
Default moveRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
cloneTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > m (TraverseRef m f a) Source #
Default cloneRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
unsafeThawTraverse :: (Traversable f, Mutable m a) => f a > m (TraverseRef m f a) Source #
Default unsafeThawRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
unsafeFreezeTraverse :: (Traversable f, Mutable m a) => TraverseRef m f a > m (f a) Source #
Default unsafeFreezeRef
for TraverseRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with TraverseRef
as the
Ref
. However, it can be useful if you are using a
just as a normal data type, independent of the TraverseRef
m f aRef
class. See
documentation for TraverseRef
for more information.
Immutable
newtype ImmutableRef a Source #
A "Ref
" that can be used to give a default Mutable
instance that
is immutable. Nothing is allocated ever, all attempts to modify it will
be ignored, and freezeRef
will just get the original thawed value.
Really only exists to be used with Immutable
.
Instances
Applicative m => DefaultMutable m a (ImmutableRef a) Source #  
Defined in Data.Mutable.Internal defaultThawRef :: a > m (ImmutableRef a) Source # defaultFreezeRef :: ImmutableRef a > m a Source # defaultCopyRef :: ImmutableRef a > a > m () Source # defaultMoveRef :: ImmutableRef a > ImmutableRef a > m () Source # defaultCloneRef :: ImmutableRef a > m (ImmutableRef a) Source # defaultUnsafeThawRef :: a > m (ImmutableRef a) Source # defaultUnsafeFreezeRef :: ImmutableRef a > m a Source #  
IsoHKD ImmutableRef (a :: Type) Source #  Use a 
Defined in Data.Mutable.Internal type HKD ImmutableRef a # unHKD :: HKD ImmutableRef a > ImmutableRef a # toHKD :: ImmutableRef a > HKD ImmutableRef a #  
type HKD ImmutableRef (a :: Type) Source #  
Defined in Data.Mutable.Internal 
thawImmutable :: Applicative m => a > m (ImmutableRef a) Source #
Default thawRef
for ImmutableRef
.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with ImmutableRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the ImmutableRef
m s aRef
class. See documentation
for ImmutableRef
for more information.
freezeImmutable :: Applicative m => ImmutableRef a > m a Source #
Default freezeRef
for ImmutableRef
. This will always return the
originally thawed value, ignoring all copies and writes.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with ImmutableRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the ImmutableRef
m s aRef
class. See documentation
for ImmutableRef
for more information.
copyImmutable :: Applicative m => ImmutableRef a > a > m () Source #
Default copyRef
for ImmutableRef
. This is a noop and does
nothing, since freezing will always return the originally thawed value.
You likely won't ever use this directly, since it is automatically
provided if you have a Mutable
instance with ImmutableRef
as the Ref
.
However, it can be useful if you are using a
just as
a normal data type, independent of the ImmutableRef
m s aRef
class. See documentation
for ImmutableRef
for more information.
Instances for Generics combinators themselves
newtype GMutableRef m f a Source #
A Ref
for instances of GMutable
, which are the GHC.Generics
combinators.
GMutableRef  

Instances
Eq (GRef_ m f a) => Eq (GMutableRef m f a) Source #  
Defined in Data.Mutable.Internal (==) :: GMutableRef m f a > GMutableRef m f a > Bool # (/=) :: GMutableRef m f a > GMutableRef m f a > Bool #  
Ord (GRef_ m f a) => Ord (GMutableRef m f a) Source #  
Defined in Data.Mutable.Internal compare :: GMutableRef m f a > GMutableRef m f a > Ordering # (<) :: GMutableRef m f a > GMutableRef m f a > Bool # (<=) :: GMutableRef m f a > GMutableRef m f a > Bool # (>) :: GMutableRef m f a > GMutableRef m f a > Bool # (>=) :: GMutableRef m f a > GMutableRef m f a > Bool # max :: GMutableRef m f a > GMutableRef m f a > GMutableRef m f a # min :: GMutableRef m f a > GMutableRef m f a > GMutableRef m f a # 
newtype MutSumF m f g a Source #
Wraps :+:
in a mutable reference. Used internally to represent
generic sum references.
MutSumF  

Utility
type family MapRef m as where ... Source #
Useful type family to
over every item in a typelevel listRef
m
ghci> :kind! MapRef IO '[Int, V.Vector Double] '[ MutVar RealWorld Int, MVector RealWorld Double ]