packages feed

changeset 0.1.1 → 0.2

raw patch · 5 files changed

+36/−13 lines, 5 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

- Control.Monad.Trans.Changeset: instance (Data.Semialign.Internal.Semialign f, Data.Monoid.RightAction.RightTorsor w s) => Data.Monoid.RightAction.RightTorsor (Control.Monad.Trans.Changeset.AlignChanges f w s) (f s)
- Data.Monoid.RightAction: instance (Data.Monoid.RightAction.RightTorsor w s, Data.Semialign.Internal.Zip f) => Data.Monoid.RightAction.RightTorsor (f w) (f s)
+ Control.Monad.Trans.Changeset: SetTo :: a -> SetTo a
+ Control.Monad.Trans.Changeset: instance (Data.Semialign.Internal.Semialign f, Witherable.Filterable f, Data.Monoid.RightAction.RightTorsor w s) => Data.Monoid.RightAction.RightTorsor (Control.Monad.Trans.Changeset.AlignChanges f w s) (f s)
+ Control.Monad.Trans.Changeset: instance Data.Foldable.Foldable Control.Monad.Trans.Changeset.SetTo
+ Control.Monad.Trans.Changeset: instance Data.Monoid.RightAction.RightAction (Control.Monad.Trans.Changeset.SetTo a) a
+ Control.Monad.Trans.Changeset: instance Data.Monoid.RightAction.RightTorsor (Control.Monad.Trans.Changeset.SetTo a) a
+ Control.Monad.Trans.Changeset: instance Data.Traversable.Traversable Control.Monad.Trans.Changeset.SetTo
+ Control.Monad.Trans.Changeset: instance GHC.Base.Functor Control.Monad.Trans.Changeset.SetTo
+ Control.Monad.Trans.Changeset: instance GHC.Classes.Eq a => GHC.Classes.Eq (Control.Monad.Trans.Changeset.SetTo a)
+ Control.Monad.Trans.Changeset: instance GHC.Classes.Ord a => GHC.Classes.Ord (Control.Monad.Trans.Changeset.SetTo a)
+ Control.Monad.Trans.Changeset: instance GHC.Generics.Generic (Control.Monad.Trans.Changeset.SetTo a)
+ Control.Monad.Trans.Changeset: instance GHC.Read.Read a => GHC.Read.Read (Control.Monad.Trans.Changeset.SetTo a)
+ Control.Monad.Trans.Changeset: instance GHC.Show.Show a => GHC.Show.Show (Control.Monad.Trans.Changeset.SetTo a)
+ Control.Monad.Trans.Changeset: newtype SetTo a
+ Data.Monoid.RightAction: instance (GHC.Base.Semigroup w, Data.Monoid.RightAction.RightTorsor w s, Data.Semialign.Internal.Zip f) => Data.Monoid.RightAction.RightTorsor (f w) (f s)
- Data.Monoid.RightAction: class RightTorsor m s
+ Data.Monoid.RightAction: class RightAction m s => RightTorsor m s

Files

CHANGELOG.md view
@@ -1,5 +1,14 @@ # Revision history for changeset +## 0.2++* Support GHC 9.12+* Drop support for GHC < 9.2+* Add SetTo+* Require RightAction as superclass for RightTorsor+* Add SeqEdit+* Add helpers changing, changed, relativeTo+ ## 0.1.1  * Add support for generic deriving
changeset.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: changeset-version: 0.1.1+version: 0.2 synopsis: Stateful monad transformer based on monoidal actions description:   A general state monad transformer with separate types for the state and the possible changes.@@ -18,15 +18,12 @@ build-type: Simple extra-doc-files: CHANGELOG.md tested-with:-  ghc ==8.6-  ghc ==8.8-  ghc ==8.10-  ghc ==9.0   ghc ==9.2   ghc ==9.4   ghc ==9.6   ghc ==9.8   ghc ==9.10+  ghc ==9.12  source-repository head   type: git@@ -78,7 +75,7 @@     Data.Monoid.RightAction.Generic    build-depends:-    base >=4.12 && <4.22,+    base >=4.16 && <4.23,     containers >=0.6 && <0.8,     indexed-traversable ^>=0.1,     mmorph >=1.1 && <1.3,
src/Control/Monad/Trans/Changeset.hs view
@@ -113,7 +113,7 @@  The type @w@ encodes /changes/ (or updates, edits, commits, diffs, patches ...) to the state @s.@ This relation is captured by the 'RightAction' type class from @monoid-extras.@-It contains a method, @'act' :: w -> s -> s@,+It contains a method, @'actRight' :: w -> s -> s@, which implements the semantics of @w@ as the type of updates to @s.@  The standard example is that of a big record where we only want to change a small portion:@@ -140,7 +140,7 @@   | Delete Text  instance RightAction ChangeAddress User where-  act = ...+  actRight = ... @  Now we can conveniently work in the monad @'ChangesetT' User [ChangeAddress] m.@@@ -411,11 +411,29 @@  -- * Change examples +-- ** Setting any value++{- | Change a value by setting it to a new value.++This change unconditionally overwrites the old value.+-}+newtype SetTo a = SetTo a+  deriving stock (Eq, Show, Read, Ord, Generic, Functor, Foldable, Traversable)++instance RightAction (SetTo a) a where+  actRight _ (SetTo a) = a++instance RightTorsor (SetTo a) a where+  differenceRight _ = SetTo+ -- ** Changing lists  {- | A list can be changed by prepending an element, or removing one.  To change an element of a list, see the indexed changes from [@changeset-lens@](hackage.haskell.org/package/changeset-lens).++To change 'Seq'uences (from @containers@) efficiently and compute the minimum edit,+see 'Data.Monoid.RightAction.Sequence.SeqEdit'. -} data ListChange a   = -- | Prepend an element@@ -673,7 +691,7 @@         (SetAlignPosition s) -> Just s         _ -> Nothing -instance (Semialign f, RightTorsor w s) => RightTorsor (AlignChanges f w s) (f s) where+instance (Semialign f, Filterable f, RightTorsor w s) => RightTorsor (AlignChanges f w s) (f s) where   differenceRight = ((AlignChanges .) .) $ alignWith $ these (const DeleteAlignPosition) SetAlignPosition $ (ChangeAlignPosition .) . differenceRight  -- ** Changing 'FunctorWithIndex'
src/Data/Monoid/RightAction.hs view
@@ -110,7 +110,7 @@ See also [monoid-extras' @Torsor@](https://hackage-content.haskell.org/package/monoid-extras/docs/Data-Monoid-Action.html#t:Torsor) for the same concept, but for left actions. -}-class RightTorsor m s where+class (RightAction m s) => RightTorsor m s where   differenceRight ::     -- | The original state     s ->@@ -126,7 +126,7 @@   differenceRight sOrig sActed = Last $ if sOrig == sActed then Nothing else Just sActed  -- | Calculate the diff per position of the container.-instance (RightTorsor w s, Zip f) => RightTorsor (f w) (f s) where+instance (Semigroup w, RightTorsor w s, Zip f) => RightTorsor (f w) (f s) where   differenceRight = zipWith differenceRight  instance {-# OVERLAPPING #-} (Num a) => RightTorsor (Sum a) (Sum a) where
src/Data/Monoid/RightAction/Coproduct.hs view
@@ -2,7 +2,6 @@  -- base import Data.Foldable (Foldable (foldl'), toList)-import Data.Typeable (Typeable) import Prelude hiding (Foldable (..))  -- containers@@ -21,7 +20,7 @@ You should usually want to use 'normaliseCoproduct'. -} newtype (:+:) m n = Coproduct {getCoproduct :: Seq (Either m n)}-  deriving (Typeable, Semigroup, Monoid)+  deriving newtype (Semigroup, Monoid)  {- | Construct a coproduct value from the left constituent monoid.