packages feed

strict-lens 0.4.0.1 → 0.4.0.2

raw patch · 3 files changed

+38/−19 lines, 3 filesdep ~lensPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: lens

API changes (from Hackage documentation)

- Data.Strict.Lens: instance (a Data.Type.Equality.~ a', b Data.Type.Equality.~ b') => Control.Lens.Each.Each (Data.Strict.Either.Either a a') (Data.Strict.Either.Either b b') a b
- Data.Strict.Lens: instance (a Data.Type.Equality.~ a', b Data.Type.Equality.~ b') => Control.Lens.Each.Each (Data.Strict.These.These a a') (Data.Strict.These.These b b') a b
- Data.Strict.Lens: instance (a Data.Type.Equality.~ a', b Data.Type.Equality.~ b') => Control.Lens.Each.Each (Data.Strict.Tuple.Pair a a') (Data.Strict.Tuple.Pair b b') a b
- Data.Strict.Lens: instance Control.Lens.Each.Each (Data.Strict.Maybe.Maybe a) (Data.Strict.Maybe.Maybe b) a b
- Data.Strict.Lens: instance Control.Lens.Iso.Strict (Data.Either.Either a b) (Data.Strict.Either.Either a b)
- Data.Strict.Lens: instance Control.Lens.Iso.Strict (GHC.Maybe.Maybe a) (Data.Strict.Maybe.Maybe a)
- Data.Strict.Lens: instance Control.Lens.Iso.Strict (a, b) (Data.Strict.Tuple.Pair a b)
- Data.Strict.Lens: instance Control.Lens.Iso.Swapped Data.Strict.Either.Either
- Data.Strict.Lens: instance Control.Lens.Iso.Swapped Data.Strict.These.These
- Data.Strict.Lens: instance Control.Lens.Iso.Swapped Data.Strict.Tuple.Pair
- Data.Strict.Lens: instance Control.Lens.Tuple.Field1 (Data.Strict.Tuple.Pair a b) (Data.Strict.Tuple.Pair a' b) a a'
- Data.Strict.Lens: instance Control.Lens.Tuple.Field2 (Data.Strict.Tuple.Pair a b) (Data.Strict.Tuple.Pair a b') b b'

Files

CHANGES.md view
@@ -1,3 +1,7 @@+## 0.4.0.2++- lens-5 support+ ## 0.4.0.1  - Fix Each These instance
src/Data/Strict/Lens.hs view
@@ -21,47 +21,56 @@     ) where  -import           Control.Applicative (pure, (<$>), (<*>))+import           Control.Applicative (pure, (<$>)) import           Prelude             (Int, flip, ($), (.))  -- Lazy variants import qualified Prelude             as L-import qualified Control.Lens        as L -import           Control.Lens        (Each (..), Field1 (..), Field2 (..),-                                      Index, Prism, Prism', Swapped (..),-                                      Traversal, indexed, iso, prism, prism',-                                      (<&>))+import           Control.Lens        (Index, Prism, Prism', Traversal, prism,+                                      prism')  import           Data.Strict         (Either (..), Maybe (..), Pair (..),-                                      Strict (..), These (..), either, maybe,-                                      swap, these)+                                      These (..), either, maybe, these) +#if !MIN_VERSION_lens(5,0,0)+import           Control.Applicative ((<*>))+import           Control.Lens        (Each (..), Field1 (..), Field2 (..),+                                      Swapped (..), indexed, iso, (<&>))+import qualified Control.Lens        as L+import           Data.Strict         (Strict (..), swap)+#endif+ ------------------------------------------------------------------------------- -- Tuple ------------------------------------------------------------------------------- -instance L.Strict (a, b) (Pair a b) where-  strict = iso toStrict toLazy-+#if !MIN_VERSION_lens(5,0,0) instance Field1 (Pair a b) (Pair a' b) a a' where   _1 k (a :!: b) = indexed k (0 :: Int) a <&> \a' -> (a' :!: b)  instance Field2 (Pair a b) (Pair a b') b b' where   _2 k (a :!: b) = indexed k (1 :: Int) b <&> \b' -> (a :!: b') +instance L.Strict (a, b) (Pair a b) where+  strict = iso toStrict toLazy+ instance Swapped Pair where   swapped = iso swap swap -type instance Index (Pair a b) = Int instance (a~a', b~b') => Each (Pair a a') (Pair b b') a b where   each f ~(a :!: b) = (:!:) <$> f a <*> f b   {-# INLINE each #-}+#endif +-- TODO: this should be removed. Probably.+type instance Index (Pair a b) = Int+ ------------------------------------------------------------------------------- -- Either ------------------------------------------------------------------------------- +#if !MIN_VERSION_lens(5,0,0) instance L.Strict (L.Either a b) (Either a b) where   strict = iso toStrict toLazy @@ -71,6 +80,7 @@ instance (a ~ a', b ~ b') => Each (Either a a') (Either b b') a b where   each f (Left x)  = Left <$> f x   each f (Right x) = Right <$> f x+#endif  -- | Analogous to 'Control.Lens.Prism._Left' in "Control.Lens.Prism". _Left :: Prism (Either a c) (Either b c) a b@@ -84,10 +94,12 @@ -- Maybe ------------------------------------------------------------------------------- +#if !MIN_VERSION_lens(5,0,0) instance L.Strict (L.Maybe a) (Maybe a) where   strict = iso toStrict toLazy  instance Each (Maybe a) (Maybe b) a b+#endif  -- | Analogous to 'Control.Lens.Prism._Just' in "Control.Lens.Prism" _Just :: Prism (Maybe a) (Maybe b) a b@@ -101,13 +113,20 @@ -- These ------------------------------------------------------------------------------- +#if !MIN_VERSION_lens(5,0,0) instance Swapped These where     swapped = iso swapThese swapThese +swapThese :: These a b -> These b a+swapThese (This a)    = That a+swapThese (That b)    = This b+swapThese (These a b) = These b a+ instance (a ~ a', b ~ b') => Each (These a a') (These b b') a b where     each f (This a)    = This <$> f a     each f (That b)    = That <$> f b     each f (These a b) = These <$> f a <*> f b+#endif  -- | A 'Control.Lens.Traversal' of the first half of a 'These', suitable for use with "Control.Lens". --@@ -156,8 +175,3 @@ -- /Note:/ cannot change type. _These :: Prism' (These a b) (a, b) _These = prism (\(a,b) -> These a b) (these (L.Left . This) (L.Left . That) (\x y -> L.Right (x, y)))--swapThese :: These a b -> These b a-swapThese (This a)    = That a-swapThese (That b)    = This b-swapThese (These a b) = These b a
strict-lens.cabal view
@@ -1,5 +1,5 @@ name:               strict-lens-version:            0.4.0.1+version:            0.4.0.2 synopsis:           Lenses for types in strict package category:           Data, Lenses description:        Lenses for types in strict package.@@ -28,6 +28,7 @@    || ==8.6.5    || ==8.8.3    || ==8.10.1+   || ==9.0.1  extra-source-files: CHANGES.md @@ -47,7 +48,7 @@    build-depends:       base    >=4.5    && <5-    , lens    >=4.19.2 && <4.20+    , lens    >=4.19.2 && <5.1     , strict  >=0.4    && <0.4.1    hs-source-dirs:   src