packages feed

mutable 0.1.0.0 → 0.1.0.1

raw patch · 7 files changed

+112/−43 lines, 7 filesdep +generic-lens-coredep ~generic-lensPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: generic-lens-core

Dependency ranges changed: generic-lens

API changes (from Hackage documentation)

- Data.Mutable.Branches: instance (Control.Monad.Primitive.PrimMonad m, Data.Mutable.Internal.GMutable m l, Data.Mutable.Branches.GMutBranchConstructor ctor m r a, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m r) (Data.Mutable.Internal.GRef_ m r) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList r r as as, Data.Generics.Product.Internal.HList.ListTuple a as, Data.Generics.Product.Internal.HList.ListTuple b (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a Data.Type.Equality.~ b) => Data.Mutable.Branches.GMutBranchSum ctor 'GHC.Types.False m l r a
- Data.Mutable.Branches: instance (Control.Monad.Primitive.PrimMonad m, Data.Mutable.Internal.GMutable m r, Data.Mutable.Branches.GMutBranchConstructor ctor m l a, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m l) (Data.Mutable.Internal.GRef_ m l) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList l l as as, Data.Generics.Product.Internal.HList.ListTuple a as, Data.Generics.Product.Internal.HList.ListTuple b (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a Data.Type.Equality.~ b) => Data.Mutable.Branches.GMutBranchSum ctor 'GHC.Types.True m l r a
- Data.Mutable.Branches: instance (Data.Mutable.Internal.GMutable m f, Data.Mutable.Internal.Mutable m a, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m f) (Data.Mutable.Internal.GRef_ m f) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList f f as as, Data.Generics.Product.Internal.HList.ListTuple a as, Data.Generics.Product.Internal.HList.ListTuple b (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a Data.Type.Equality.~ b) => Data.Mutable.Branches.GMutBranchConstructor ctor m (GHC.Generics.M1 GHC.Generics.C ('GHC.Generics.MetaCons ctor fixity fields) f) a
- Data.Mutable.Branches: instance (ctor_ Data.Type.Equality.~ GHC.TypeLits.AppendSymbol "_" ctor) => GHC.OverloadedLabels.IsLabel ctor_ (Data.Mutable.Branches.CLabel ctor)
- Data.Mutable.Instances: instance (GHC.Base.Monad m, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Mutable m (Data.Generics.Product.Internal.HList.HList as), Data.Mutable.Internal.Ref m (Data.Generics.Product.Internal.HList.HList as) Data.Type.Equality.~ Data.Mutable.Instances.HListRef m as) => Data.Mutable.Internal.Mutable m (Data.Generics.Product.Internal.HList.HList (a : as))
- Data.Mutable.Instances: instance forall a1 (m :: * -> *) (f :: a1 -> *) (a2 :: a1) (as :: [a1]). (GHC.Base.Monad m, Data.Mutable.Internal.Mutable m (f a2), Data.Mutable.Internal.Mutable m (Data.Vinyl.Core.Rec f as), Data.Mutable.Internal.Ref m (Data.Vinyl.Core.Rec f as) Data.Type.Equality.~ Data.Vinyl.Core.Rec (Data.Mutable.Instances.RecRef m f) as) => Data.Mutable.Internal.Mutable m (Data.Vinyl.Core.Rec f (a2 : as))
- Data.Mutable.Instances: instance forall k (m :: * -> *) (as :: [k]) (f :: k -> *). (GHC.Base.Monad m, Data.Vinyl.Core.RecApplicative as, Data.Vinyl.TypeLevel.NatToInt (Data.Vinyl.TypeLevel.RLength as), Data.Vinyl.Core.RPureConstrained (Data.Vinyl.ARec.IndexableField as) as, Data.Mutable.Internal.Mutable m (Data.Vinyl.Core.Rec f as), Data.Mutable.Internal.Ref m (Data.Vinyl.Core.Rec f as) Data.Type.Equality.~ Data.Vinyl.Core.Rec (Data.Mutable.Instances.RecRef m f) as) => Data.Mutable.Internal.Mutable m (Data.Vinyl.ARec.ARec f as)
- Data.Mutable.Instances: instance forall k1 k (m :: * -> *) (f :: k -> *) (g :: k1 -> k) (a :: k1). Data.Mutable.Internal.Mutable m (f (g a)) => Data.Mutable.Internal.Mutable m (Data.Functor.Compose.Compose f g a)
- Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) Data.Type.Equality.~ z (Data.Mutable.Internal.RefFor m)) => Data.Mutable.Parts.HKDMutParts m z (GHC.Generics.K1 i (Data.Mutable.Internal.RefFor m c)) (GHC.Generics.K1 i (Data.Mutable.Parts.MutPart m (z Data.Vinyl.Functor.Identity) c))
- Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) Data.Type.Equality.~ z (Data.Mutable.Internal.RefFor m)) => Data.Mutable.Parts.HKDMutParts m z GHC.Generics.U1 GHC.Generics.U1
- Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) Data.Type.Equality.~ z (Data.Mutable.Internal.RefFor m), (TypeError ...)) => Data.Mutable.Parts.HKDMutParts m z GHC.Generics.V1 GHC.Generics.V1
- Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m s, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Ref m s Data.Type.Equality.~ Data.Mutable.Internal.GRef m s, Data.Generics.Product.Internal.GLens.GLens' (Data.Mutable.Parts.HasTotalFieldPSym fld) (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s)) (Data.Mutable.Internal.Ref m a), Data.Generics.Product.Fields.HasField' fld s a) => Data.Mutable.Parts.FieldMut fld m s a
- Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m s, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Ref m s Data.Type.Equality.~ Data.Mutable.Internal.GRef m s, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s)) (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s)) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList (GHC.Generics.Rep s) (GHC.Generics.Rep s) as as, Data.Generics.Product.Internal.HList.ListTuple a as, Data.Generics.Product.Internal.HList.ListTuple b (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a Data.Type.Equality.~ b) => Data.Mutable.Parts.TupleMut m s a
- Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m s, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Ref m s Data.Type.Equality.~ Data.Mutable.Internal.GRef m s, gref Data.Type.Equality.~ Data.Mutable.Parts.Fst (Data.Mutable.Parts.Traverse (Data.Mutable.Internal.GRef_ m (Data.Generics.Product.Internal.Positions.CRep s)) 1), GHC.Types.Coercible (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s) ()) (gref ()), Data.Generics.Product.Internal.GLens.GLens' (Data.Mutable.Parts.HasTotalPositionPSym i) gref (Data.Mutable.Internal.Ref m a), Data.Generics.Product.Positions.HasPosition' i s a) => Data.Mutable.Parts.PosMut i m s a
- Data.Mutable.Parts: instance forall k (m :: * -> *) (z :: (* -> *) -> *) (i :: k -> *) (i' :: k -> *) (o :: k -> *). (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) Data.Type.Equality.~ z (Data.Mutable.Internal.RefFor m), (TypeError ...)) => Data.Mutable.Parts.HKDMutParts m z (i GHC.Generics.:+: i') o
+ Data.Mutable.Branches: instance (Control.Monad.Primitive.PrimMonad m, Data.Mutable.Internal.GMutable m l, Data.Mutable.Branches.GMutBranchConstructor ctor m r a, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m r) (Data.Mutable.Internal.GRef_ m r) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList r r as as, Data.Generics.Product.Internal.HList.ListTuple a a as as, Data.Generics.Product.Internal.HList.ListTuple b b (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a GHC.Types.~ b) => Data.Mutable.Branches.GMutBranchSum ctor 'GHC.Types.False m l r a
+ Data.Mutable.Branches: instance (Control.Monad.Primitive.PrimMonad m, Data.Mutable.Internal.GMutable m r, Data.Mutable.Branches.GMutBranchConstructor ctor m l a, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m l) (Data.Mutable.Internal.GRef_ m l) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList l l as as, Data.Generics.Product.Internal.HList.ListTuple a a as as, Data.Generics.Product.Internal.HList.ListTuple b b (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a GHC.Types.~ b) => Data.Mutable.Branches.GMutBranchSum ctor 'GHC.Types.True m l r a
+ Data.Mutable.Branches: instance (Data.Mutable.Internal.GMutable m f, Data.Mutable.Internal.Mutable m a, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m f) (Data.Mutable.Internal.GRef_ m f) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList f f as as, Data.Generics.Product.Internal.HList.ListTuple a a as as, Data.Generics.Product.Internal.HList.ListTuple b b (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a GHC.Types.~ b) => Data.Mutable.Branches.GMutBranchConstructor ctor m (GHC.Generics.M1 GHC.Generics.C ('GHC.Generics.MetaCons ctor fixity fields) f) a
+ Data.Mutable.Branches: instance (ctor_ GHC.Types.~ GHC.TypeLits.AppendSymbol "_" ctor) => GHC.OverloadedLabels.IsLabel ctor_ (Data.Mutable.Branches.CLabel ctor)
+ Data.Mutable.Instances: instance (GHC.Base.Monad m, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Mutable m (Data.Generics.Product.Internal.HList.HList as), Data.Mutable.Internal.Ref m (Data.Generics.Product.Internal.HList.HList as) GHC.Types.~ Data.Mutable.Instances.HListRef m as) => Data.Mutable.Internal.Mutable m (Data.Generics.Product.Internal.HList.HList (a : as))
+ Data.Mutable.Instances: instance forall a1 (m :: * -> *) (f :: a1 -> *) (a2 :: a1) (as :: [a1]). (GHC.Base.Monad m, Data.Mutable.Internal.Mutable m (f a2), Data.Mutable.Internal.Mutable m (Data.Vinyl.Core.Rec f as), Data.Mutable.Internal.Ref m (Data.Vinyl.Core.Rec f as) GHC.Types.~ Data.Vinyl.Core.Rec (Data.Mutable.Instances.RecRef m f) as) => Data.Mutable.Internal.Mutable m (Data.Vinyl.Core.Rec f (a2 : as))
+ Data.Mutable.Instances: instance forall k (m :: * -> *) (as :: [k]) (f :: k -> *). (GHC.Base.Monad m, Data.Vinyl.Core.RecApplicative as, Data.Vinyl.TypeLevel.NatToInt (Data.Vinyl.TypeLevel.RLength as), Data.Vinyl.Core.RPureConstrained (Data.Vinyl.ARec.IndexableField as) as, Data.Mutable.Internal.Mutable m (Data.Vinyl.Core.Rec f as), Data.Mutable.Internal.Ref m (Data.Vinyl.Core.Rec f as) GHC.Types.~ Data.Vinyl.Core.Rec (Data.Mutable.Instances.RecRef m f) as) => Data.Mutable.Internal.Mutable m (Data.Vinyl.ARec.ARec f as)
+ Data.Mutable.Instances: instance forall k k1 (m :: * -> *) (f :: k -> *) (g :: k1 -> k) (a :: k1). Data.Mutable.Internal.Mutable m (f (g a)) => Data.Mutable.Internal.Mutable m (Data.Functor.Compose.Compose f g a)
+ Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) GHC.Types.~ z (Data.Mutable.Internal.RefFor m)) => Data.Mutable.Parts.HKDMutParts m z (GHC.Generics.K1 i (Data.Mutable.Internal.RefFor m c)) (GHC.Generics.K1 i (Data.Mutable.Parts.MutPart m (z Data.Vinyl.Functor.Identity) c))
+ Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) GHC.Types.~ z (Data.Mutable.Internal.RefFor m)) => Data.Mutable.Parts.HKDMutParts m z GHC.Generics.U1 GHC.Generics.U1
+ Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) GHC.Types.~ z (Data.Mutable.Internal.RefFor m), (TypeError ...)) => Data.Mutable.Parts.HKDMutParts m z GHC.Generics.V1 GHC.Generics.V1
+ Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m s, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Ref m s GHC.Types.~ Data.Mutable.Internal.GRef m s, Data.Generics.Product.Internal.GLens.GLens' (Data.Mutable.Parts.HasTotalFieldPSym fld) (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s)) (Data.Mutable.Internal.Ref m a), Data.Generics.Product.Fields.HasField' fld s a) => Data.Mutable.Parts.FieldMut fld m s a
+ Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m s, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Ref m s GHC.Types.~ Data.Mutable.Internal.GRef m s, Data.Generics.Product.Internal.HList.GIsList (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s)) (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s)) (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Generics.Product.Internal.HList.GIsList (GHC.Generics.Rep s) (GHC.Generics.Rep s) as as, Data.Generics.Product.Internal.HList.ListTuple a a as as, Data.Generics.Product.Internal.HList.ListTuple b b (Data.Mutable.Instances.MapRef m as) (Data.Mutable.Instances.MapRef m as), Data.Mutable.Internal.Ref m a GHC.Types.~ b) => Data.Mutable.Parts.TupleMut m s a
+ Data.Mutable.Parts: instance (Data.Mutable.Internal.Mutable m s, Data.Mutable.Internal.Mutable m a, Data.Mutable.Internal.Ref m s GHC.Types.~ Data.Mutable.Internal.GRef m s, gref GHC.Types.~ Data.Mutable.Parts.Fst (Data.Mutable.Parts.Traverse (Data.Mutable.Internal.GRef_ m (Data.Generics.Product.Internal.Positions.CRep s)) 1), GHC.Types.Coercible (Data.Mutable.Internal.GRef_ m (GHC.Generics.Rep s) ()) (gref ()), Data.Generics.Product.Internal.GLens.GLens' (Data.Mutable.Parts.HasTotalPositionPSym i) gref (Data.Mutable.Internal.Ref m a), Data.Generics.Product.Positions.HasPosition' i s a) => Data.Mutable.Parts.PosMut i m s a
+ Data.Mutable.Parts: instance forall k (m :: * -> *) (z :: (* -> *) -> *) (i :: k -> *) (i' :: k -> *) (o :: k -> *). (Data.Mutable.Internal.Mutable m (z Data.Vinyl.Functor.Identity), Data.Mutable.Internal.Ref m (z Data.Vinyl.Functor.Identity) GHC.Types.~ z (Data.Mutable.Internal.RefFor m), (TypeError ...)) => Data.Mutable.Parts.HKDMutParts m z (i GHC.Generics.:+: i') o
- Data.Mutable: CLabel :: CLabel
+ Data.Mutable: CLabel :: CLabel (ctor :: Symbol)
- Data.Mutable: Label :: Label
+ Data.Mutable: Label :: Label (a :: Symbol)
- Data.Mutable: type family PrimState (m :: Type -> Type) :: Type
+ Data.Mutable: type family PrimState (m :: Type -> Type)
- Data.Mutable.Branches: CLabel :: CLabel
+ Data.Mutable.Branches: CLabel :: CLabel (ctor :: Symbol)
- Data.Mutable.Parts: Label :: Label
+ Data.Mutable.Parts: Label :: Label (a :: Symbol)

Files

CHANGELOG.md view
@@ -1,6 +1,15 @@ Changelog ========= +Version 0.1.0.1+---------------++*February 11, 2020*++<https://github.com/mstksg/mutable/releases/tag/v0.1.0.1>++*   Update to work with *generic-lens-2.0.0.0* and *generic-lens-core-2.0.0.0*.+ Version 0.1.0.0 --------------- 
README.md view
@@ -4,10 +4,14 @@ [![mutable on Hackage](https://img.shields.io/hackage/v/mutable.svg?maxAge=86400)](https://hackage.haskell.org/package/mutable) [![Build Status](https://travis-ci.org/mstksg/mutable.svg?branch=master)](https://travis-ci.org/mstksg/mutable) -[**Documentation and Walkthrough**][docs]+**[Documentation and Walkthrough][docs]**  [docs]: https://mutable.jle.im +**[Introductory Blog Post][blog]**++[blog]: https://blog.jle.im/entry/introducing-the-mutable-library.html+ Beautiful Mutable Values ------------------------ @@ -32,8 +36,9 @@ one field), and also efficient entire-datatype copies/updates, as well, in many cases. -Check out the [documentation home page][docs], [haddock reference][haddock], or-read below for motivation and high-level descriptions.+Check out the [documentation home page][docs], [haddock reference][haddock],+[introductory blog post on insights and lessons learned][blog], or read below+for motivation and high-level descriptions.  [haddock]: https://hackage.haskell.org/package/mutable @@ -80,8 +85,7 @@ functions that each modify different items in a vector in sequence, and you want to run them many times interleaved, or one after the other.) -Composite Datatype-------------------+### Composite Datatype  That all works for `MVector`, but let's say you have a simple composite data type that is two vectors:@@ -158,6 +162,47 @@ This is a type of composition and interleaving that cannot be achieved by simply breaking down `TwoVec` and running functions that work purely on each of the two vectors individually.++Mutable Sum Types+-----------------++There is also support for mutable sum types, as well.  Here is the automatic+definition of a *[mutable linked list][ll]*:++[ll]: https://en.wikipedia.org/wiki/Linked_list++```haskell+data List a = Nil | Cons a (List a)+  deriving (Show, Generic)+infixr 5 `Cons`++instance (Mutable m a, PrimMonad m) => Mutable m (List a) where+    type Ref m (List a) = GRef m (List a)+```++We can write a function to "pop" out the top value and shift the rest of the+list up:++```haskell+popStack+    :: (PrimMonad m, Mutable m a)+    => Ref m (List a)+    -> m (Maybe a)+popStack xs = do+    c <- projectBranch (constrMB #_Cons) xs+    forM c $ \(y, ys) -> do+      o <- freezeRef y+      moveRef xs ys+      pure o+```++```haskell+ghci> runST $ do+    r <- thawRef $ 1 `Cons` 2 `Cons` 3 `Cons` Nil+    y <- popStack r+    (y,) <$> freezeRef r+-- => (Just 1, 2 `Cons` 3 `Cons` Nil)+```  Show me the numbers -------------------
mutable.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 4bc371a3f5a9dc170b74be324280aeabe3d89a2be7c8766d3b5c3e27b5b29333+-- hash: 71081ba24c9c597ffd540904a9115e3f1dc62b4606dab2916c17c6961d9cbdd8  name:           mutable-version:        0.1.0.0+version:        0.1.0.1 synopsis:       Automatic piecewise-mutable references for your types description:    Associate and generate "piecewise-mutable" versions for your composite data                 types.  Think of it like a "generalized MVector for all ADTs".@@ -53,7 +53,8 @@   build-depends:       base >=4.11 && <5     , constraints-    , generic-lens >=1.1+    , generic-lens >=2.0+    , generic-lens-core >=2.0     , primitive >=0.6.4     , reflection     , transformers
src/Data/Mutable/Branches.hs view
@@ -58,6 +58,7 @@  import           Control.Monad import           Control.Monad.Primitive+import           Data.Generics.Product.Internal.HList import           Data.Maybe import           Data.Mutable.Class import           Data.Mutable.Instances@@ -138,7 +139,7 @@ -- @ -- nilBranch :: MutBranch m (List a) () -- nilBranch = constrMB #_Nil--- +-- -- consBranch :: MutBranch m (List a) (a, List a) -- consBranch = constrMB #_Cons -- @@@ -193,14 +194,14 @@       --       -- @       -- ghci> r <- thawRef (Left 10)-      -- ghci> s <- cloneBranch (constrMB #_Left)+      -- ghci> s <- projectBranch (constrMB #_Left) r       -- ghci> case s of Just s' -> freezeRef s'       -- 10       -- @       --       -- @       -- ghci> r <- thawRef (Right True)-      -- ghci> s <- cloneBranch (constrMB #_Left)+      -- ghci> s <- projectBranch (constrMB #_Left) r       -- ghci> case s of Nothing -> "it was Right"       -- "it was Right"       -- @@@ -562,15 +563,18 @@ instance       ( GMutable m f       , Mutable m a-      , GL.GIsList (GRef_ m f) (GRef_ m f) (MapRef m as) (MapRef m as)-      , GL.GIsList f f as as-      , GL.ListTuple a as-      , GL.ListTuple b (MapRef m as)+      , GIsList (GRef_ m f) (GRef_ m f) (MapRef m as) (MapRef m as)+      , GIsList f f as as+      , ListTuple a a as as+      , ListTuple b b (MapRef m as) (MapRef m as)       , Ref m a ~ b       )       => GMutBranchConstructor ctor m (M1 C ('MetaCons ctor fixity fields) f) a where-    gmbcProj _  = pure . Just . GL.listToTuple . GLP.view GL.glist . unM1-    gmbcEmbed _ = pure . M1 . GLP.view GL.glistR . GL.tupleToList+    gmbcProj _  = pure . Just+                . listToTuple @b @b @(MapRef m as) @(MapRef m as)+                . GLP.view glist . unM1+    gmbcEmbed _ = pure . M1 . GLP.view (GL.fromIso glist)+                . tupleToList @b @_ @(MapRef m as)  instance GMutBranchConstructor ctor m f a => GMutBranchConstructor ctor m (M1 D meta f) a where     gmbcProj  lb = gmbcProj lb . unM1@@ -593,33 +597,35 @@       ( PrimMonad m       , GMutable m r       , GMutBranchConstructor ctor m l a-      , GL.GIsList (GRef_ m l) (GRef_ m l) (MapRef m as) (MapRef m as)-      , GL.GIsList l l as as-      , GL.ListTuple a as-      , GL.ListTuple b (MapRef m as)+      , GIsList (GRef_ m l) (GRef_ m l) (MapRef m as) (MapRef m as)+      , GIsList l l as as+      , ListTuple a a as as+      , ListTuple b b (MapRef m as) (MapRef m as)       , Ref m a ~ b       )       => GMutBranchSum ctor 'True m l r a where     gmbsProj lb (MutSumF r) = readMutVar r >>= \case       L1 x -> gmbcProj lb x       R1 _ -> pure Nothing-    gmbsEmbed _ = fmap MutSumF . newMutVar . L1 . GLP.view GL.glistR . GL.tupleToList+    gmbsEmbed _ = fmap MutSumF . newMutVar . L1 . GLP.view (GL.fromIso glist)+                . tupleToList @b @_ @(MapRef m as)  instance       ( PrimMonad m       , GMutable m l       , GMutBranchConstructor ctor m r a-      , GL.GIsList (GRef_ m r) (GRef_ m r) (MapRef m as) (MapRef m as)-      , GL.GIsList r r as as-      , GL.ListTuple a as-      , GL.ListTuple b (MapRef m as)+      , GIsList (GRef_ m r) (GRef_ m r) (MapRef m as) (MapRef m as)+      , GIsList r r as as+      , ListTuple a a as as+      , ListTuple b b (MapRef m as) (MapRef m as)       , Ref m a ~ b       )       => GMutBranchSum ctor 'False m l r a where     gmbsProj lb (MutSumF r) = readMutVar r >>= \case       L1 _ -> pure Nothing       R1 x -> gmbcProj lb x-    gmbsEmbed _ = fmap MutSumF . newMutVar . R1 . GLP.view GL.glistR . GL.tupleToList+    gmbsEmbed _ = fmap MutSumF . newMutVar . R1 . GLP.view (GL.fromIso glist)+                . tupleToList @b @_ @(MapRef m as)  -- | Create a 'MutBranch' for any data type with a 'Generic' instance by -- specifying the constructor name using OverloadedLabels
src/Data/Mutable/Instances.hs view
@@ -62,7 +62,7 @@ import           Data.Functor.Identity import           Data.Functor.Product import           Data.Functor.Sum-import           Data.GenericLens.Internal                 (HList(..))+import           Data.Generics.Product.Internal.HList      (HList(..)) import           Data.Kind import           Data.Mutable.Internal import           Data.Ord
src/Data/Mutable/Internal.hs view
@@ -173,7 +173,12 @@ -- -- See <https://mutable.jle.im/02-mutable-and-ref.html> for more -- information on this typeclass and how to define instances--- automatically.+-- automatically, and also+--+-- *  <https://mutable.jle.im/05-mutable-parts.html> for more information+--    on dealing with record types+-- *  <https://mutable.jle.im/06-mutable-branches> for more information+--    on dealing with sum types class Monad m => Mutable m a where     -- | Links the type @a@ to the type of its canonical "mutable version".     --
src/Data/Mutable/Parts.hs view
@@ -58,20 +58,23 @@   ) where  import           Data.Coerce+import           Data.Generics.Product.Internal.HList import           Data.Kind import           Data.Mutable.Class import           Data.Mutable.Instances-import           Data.Vinyl hiding                      (HList)+import           Data.Vinyl hiding                        (HList) import           Data.Vinyl.Functor import           GHC.Generics import           GHC.TypeLits-import qualified Control.Category                       as C-import qualified Data.GenericLens.Internal              as GL-import qualified Data.Generics.Internal.Profunctor.Lens as GLP-import qualified Data.Generics.Product.Fields           as GL-import qualified Data.Generics.Product.Positions        as GL-import qualified Data.Vinyl.TypeLevel                   as V-import qualified Data.Vinyl.XRec                        as X+import qualified Control.Category                         as C+import qualified Data.GenericLens.Internal                as GL+import qualified Data.Generics.Internal.Profunctor.Lens   as GLP+import qualified Data.Generics.Product.Fields             as GL+import qualified Data.Generics.Product.Internal.GLens     as GL+import qualified Data.Generics.Product.Internal.Positions as GL+import qualified Data.Generics.Product.Positions          as GL+import qualified Data.Vinyl.TypeLevel                     as V+import qualified Data.Vinyl.XRec                          as X   -- | A @'MutPart' m s a@ is a way to "zoom into" an @a@, as a part of@@ -588,15 +591,15 @@       ( Mutable m s       , Mutable m a       , Ref m s ~ GRef m s-      , GL.GIsList (GRef_ m (Rep s)) (GRef_ m (Rep s)) (MapRef m as) (MapRef m as)-      , GL.GIsList (Rep s) (Rep s) as as-      , GL.ListTuple a as-      , GL.ListTuple b (MapRef m as)+      , GIsList (GRef_ m (Rep s)) (GRef_ m (Rep s)) (MapRef m as) (MapRef m as)+      , GIsList (Rep s) (Rep s) as as+      , ListTuple a a as as+      , ListTuple b b (MapRef m as) (MapRef m as)       , Ref m a ~ b       )       => TupleMut m s a where-    tupleMut = MutPart $ GL.listToTuple-                       . GLP.view GL.glist+    tupleMut = MutPart $ listToTuple @b @b @(MapRef m as) @(MapRef m as)+                       . GLP.view glist                        . unGRef  -- | A helpful wrapper over @'withPart' 'tupleMut'@.  Directly operate on