Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-microlens for openSUSE:Factory checked in at 2025-10-10 17:10:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-microlens (Old) and /work/SRC/openSUSE:Factory/.ghc-microlens.new.5300 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-microlens" Fri Oct 10 17:10:46 2025 rev:26 rq:1310465 version:0.5.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-microlens/ghc-microlens.changes 2025-03-03 16:05:03.159057739 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-microlens.new.5300/ghc-microlens.changes 2025-10-10 17:12:42.933741954 +0200 @@ -1,0 +2,8 @@ +Mon Sep 22 02:11:05 UTC 2025 - Peter Simons <[email protected]> + +- Update microlens to version 0.5.0.0. + # 0.5.0.0 + + * Move definitions for Field<N> e.g. `Field1` from `Lens.Micro.Interal` to `Lens.Micro`. This is a breaking change for users of these classes and instances. To upgrade, update your imports, e.g. `import Lens.Micro.Internal (Field1(..))` -> `import Lens.Micro (Field1(..))`. + +------------------------------------------------------------------- Old: ---- microlens-0.4.14.0.tar.gz New: ---- microlens-0.5.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-microlens.spec ++++++ --- /var/tmp/diff_new_pack.pnlpxe/_old 2025-10-10 17:12:43.377760669 +0200 +++ /var/tmp/diff_new_pack.pnlpxe/_new 2025-10-10 17:12:43.381760838 +0200 @@ -19,7 +19,7 @@ %global pkg_name microlens %global pkgver %{pkg_name}-%{version} Name: ghc-%{pkg_name} -Version: 0.4.14.0 +Version: 0.5.0.0 Release: 0 Summary: A tiny lens library with no dependencies License: BSD-3-Clause ++++++ microlens-0.4.14.0.tar.gz -> microlens-0.5.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.14.0/CHANGELOG.md new/microlens-0.5.0.0/CHANGELOG.md --- old/microlens-0.4.14.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/microlens-0.5.0.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,7 @@ +# 0.5.0.0 + +* Move definitions for Field<N> e.g. `Field1` from `Lens.Micro.Interal` to `Lens.Micro`. This is a breaking change for users of these classes and instances. To upgrade, update your imports, e.g. `import Lens.Micro.Internal (Field1(..))` -> `import Lens.Micro (Field1(..))`. + # 0.4.14.0 * Add optics `mapMOf`, `rewriteMOf`, `transformMOf`, `anyOf`, `allOf`, `noneOf`, `foldMapOf`, and `cosmosOf`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.14.0/microlens.cabal new/microlens-0.5.0.0/microlens.cabal --- old/microlens-0.4.14.0/microlens.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/microlens-0.5.0.0/microlens.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: microlens -version: 0.4.14.0 +version: 0.5.0.0 synopsis: A tiny lens library with no dependencies description: NOTE: If you're writing an app, you probably want <http://hackage.haskell.org/package/microlens-platform microlens-platform> – it has the most features. <http://hackage.haskell.org/package/microlens microlens> is intended more for library writers who want a tiny lens library (after all, lenses are pretty useful for everything, not just for updating records!). @@ -65,6 +65,7 @@ Lens.Micro.Extras Lens.Micro.Internal Lens.Micro.Type + Lens.Micro.FieldN -- other-modules: -- other-extensions: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.14.0/src/Lens/Micro/FieldN.hs new/microlens-0.5.0.0/src/Lens/Micro/FieldN.hs --- old/microlens-0.4.14.0/src/Lens/Micro/FieldN.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/microlens-0.5.0.0/src/Lens/Micro/FieldN.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,248 @@ +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE FlexibleInstances #-} + +module Lens.Micro.FieldN where + +import Lens.Micro.Type + +class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where + {- | +Gives access to the 1st field of a tuple (up to 5-tuples). + +Getting the 1st component: + +>>> (1,2,3,4,5) ^. _1 +1 + +Setting the 1st component: + +>>> (1,2,3) & _1 .~ 10 +(10,2,3) + +Note that this lens is lazy, and can set fields even of 'undefined': + +>>> set _1 10 undefined :: (Int, Int) +(10,*** Exception: Prelude.undefined + +This is done to avoid violating a lens law stating that you can get back what you put: + +>>> view _1 . set _1 10 $ (undefined :: (Int, Int)) +10 + +The implementation (for 2-tuples) is: + +@ +'_1' f t = (,) '<$>' f ('fst' t) + '<*>' 'pure' ('snd' t) +@ + +or, alternatively, + +@ +'_1' f ~(a,b) = (\\a' -> (a',b)) '<$>' f a +@ + +(where @~@ means a <https://wiki.haskell.org/Lazy_pattern_match lazy pattern>). + +'_2', '_3', '_4', and '_5' are also available (see below). + -} + _1 :: Lens s t a b + +instance Field1 (a,b) (a',b) a a' where + _1 k ~(a,b) = (\a' -> (a',b)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c) (a',b,c) a a' where + _1 k ~(a,b,c) = (\a' -> (a',b,c)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c,d) (a',b,c,d) a a' where + _1 k ~(a,b,c,d) = (\a' -> (a',b,c,d)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c,d,e) (a',b,c,d,e) a a' where + _1 k ~(a,b,c,d,e) = (\a' -> (a',b,c,d,e)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c,d,e,f) (a',b,c,d,e,f) a a' where + _1 k ~(a,b,c,d,e,f) = (\a' -> (a',b,c,d,e,f)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c,d,e,f,g) (a',b,c,d,e,f,g) a a' where + _1 k ~(a,b,c,d,e,f,g) = (\a' -> (a',b,c,d,e,f,g)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c,d,e,f,g,h) (a',b,c,d,e,f,g,h) a a' where + _1 k ~(a,b,c,d,e,f,g,h) = (\a' -> (a',b,c,d,e,f,g,h)) <$> k a + {-# INLINE _1 #-} + +instance Field1 (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a' where + _1 k ~(a,b,c,d,e,f,g,h,i) = (\a' -> (a',b,c,d,e,f,g,h,i)) <$> k a + {-# INLINE _1 #-} + +class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _2 :: Lens s t a b + +instance Field2 (a,b) (a,b') b b' where + _2 k ~(a,b) = (\b' -> (a,b')) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c) (a,b',c) b b' where + _2 k ~(a,b,c) = (\b' -> (a,b',c)) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c,d) (a,b',c,d) b b' where + _2 k ~(a,b,c,d) = (\b' -> (a,b',c,d)) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c,d,e) (a,b',c,d,e) b b' where + _2 k ~(a,b,c,d,e) = (\b' -> (a,b',c,d,e)) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c,d,e,f) (a,b',c,d,e,f) b b' where + _2 k ~(a,b,c,d,e,f) = (\b' -> (a,b',c,d,e,f)) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c,d,e,f,g) (a,b',c,d,e,f,g) b b' where + _2 k ~(a,b,c,d,e,f,g) = (\b' -> (a,b',c,d,e,f,g)) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c,d,e,f,g,h) (a,b',c,d,e,f,g,h) b b' where + _2 k ~(a,b,c,d,e,f,g,h) = (\b' -> (a,b',c,d,e,f,g,h)) <$> k b + {-# INLINE _2 #-} + +instance Field2 (a,b,c,d,e,f,g,h,i) (a,b',c,d,e,f,g,h,i) b b' where + _2 k ~(a,b,c,d,e,f,g,h,i) = (\b' -> (a,b',c,d,e,f,g,h,i)) <$> k b + {-# INLINE _2 #-} + +class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _3 :: Lens s t a b + +instance Field3 (a,b,c) (a,b,c') c c' where + _3 k ~(a,b,c) = (\c' -> (a,b,c')) <$> k c + {-# INLINE _3 #-} + +instance Field3 (a,b,c,d) (a,b,c',d) c c' where + _3 k ~(a,b,c,d) = (\c' -> (a,b,c',d)) <$> k c + {-# INLINE _3 #-} + +instance Field3 (a,b,c,d,e) (a,b,c',d,e) c c' where + _3 k ~(a,b,c,d,e) = (\c' -> (a,b,c',d,e)) <$> k c + {-# INLINE _3 #-} + +instance Field3 (a,b,c,d,e,f) (a,b,c',d,e,f) c c' where + _3 k ~(a,b,c,d,e,f) = (\c' -> (a,b,c',d,e,f)) <$> k c + {-# INLINE _3 #-} + +instance Field3 (a,b,c,d,e,f,g) (a,b,c',d,e,f,g) c c' where + _3 k ~(a,b,c,d,e,f,g) = (\c' -> (a,b,c',d,e,f,g)) <$> k c + {-# INLINE _3 #-} + +instance Field3 (a,b,c,d,e,f,g,h) (a,b,c',d,e,f,g,h) c c' where + _3 k ~(a,b,c,d,e,f,g,h) = (\c' -> (a,b,c',d,e,f,g,h)) <$> k c + {-# INLINE _3 #-} + +instance Field3 (a,b,c,d,e,f,g,h,i) (a,b,c',d,e,f,g,h,i) c c' where + _3 k ~(a,b,c,d,e,f,g,h,i) = (\c' -> (a,b,c',d,e,f,g,h,i)) <$> k c + {-# INLINE _3 #-} + +class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _4 :: Lens s t a b + +instance Field4 (a,b,c,d) (a,b,c,d') d d' where + _4 k ~(a,b,c,d) = (\d' -> (a,b,c,d')) <$> k d + {-# INLINE _4 #-} + +instance Field4 (a,b,c,d,e) (a,b,c,d',e) d d' where + _4 k ~(a,b,c,d,e) = (\d' -> (a,b,c,d',e)) <$> k d + {-# INLINE _4 #-} + +instance Field4 (a,b,c,d,e,f) (a,b,c,d',e,f) d d' where + _4 k ~(a,b,c,d,e,f) = (\d' -> (a,b,c,d',e,f)) <$> k d + {-# INLINE _4 #-} + +instance Field4 (a,b,c,d,e,f,g) (a,b,c,d',e,f,g) d d' where + _4 k ~(a,b,c,d,e,f,g) = (\d' -> (a,b,c,d',e,f,g)) <$> k d + {-# INLINE _4 #-} + +instance Field4 (a,b,c,d,e,f,g,h) (a,b,c,d',e,f,g,h) d d' where + _4 k ~(a,b,c,d,e,f,g,h) = (\d' -> (a,b,c,d',e,f,g,h)) <$> k d + {-# INLINE _4 #-} + +instance Field4 (a,b,c,d,e,f,g,h,i) (a,b,c,d',e,f,g,h,i) d d' where + _4 k ~(a,b,c,d,e,f,g,h,i) = (\d' -> (a,b,c,d',e,f,g,h,i)) <$> k d + {-# INLINE _4 #-} + +class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _5 :: Lens s t a b + +instance Field5 (a,b,c,d,e) (a,b,c,d,e') e e' where + _5 k ~(a,b,c,d,e) = (\e' -> (a,b,c,d,e')) <$> k e + {-# INLINE _5 #-} + +instance Field5 (a,b,c,d,e,f) (a,b,c,d,e',f) e e' where + _5 k ~(a,b,c,d,e,f) = (\e' -> (a,b,c,d,e',f)) <$> k e + {-# INLINE _5 #-} + +instance Field5 (a,b,c,d,e,f,g) (a,b,c,d,e',f,g) e e' where + _5 k ~(a,b,c,d,e,f,g) = (\e' -> (a,b,c,d,e',f,g)) <$> k e + {-# INLINE _5 #-} + +instance Field5 (a,b,c,d,e,f,g,h) (a,b,c,d,e',f,g,h) e e' where + _5 k ~(a,b,c,d,e,f,g,h) = (\e' -> (a,b,c,d,e',f,g,h)) <$> k e + {-# INLINE _5 #-} + +instance Field5 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e',f,g,h,i) e e' where + _5 k ~(a,b,c,d,e,f,g,h,i) = (\e' -> (a,b,c,d,e',f,g,h,i)) <$> k e + {-# INLINE _5 #-} + +class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _6 :: Lens s t a b + +instance Field6 (a,b,c,d,e,f) (a,b,c,d,e,f') f f' where + _6 k ~(a,b,c,d,e,f) = (\f' -> (a,b,c,d,e,f')) <$> k f + {-# INLINE _6 #-} + +instance Field6 (a,b,c,d,e,f,g) (a,b,c,d,e,f',g) f f' where + _6 k ~(a,b,c,d,e,f,g) = (\f' -> (a,b,c,d,e,f',g)) <$> k f + {-# INLINE _6 #-} + +instance Field6 (a,b,c,d,e,f,g,h) (a,b,c,d,e,f',g,h) f f' where + _6 k ~(a,b,c,d,e,f,g,h) = (\f' -> (a,b,c,d,e,f',g,h)) <$> k f + {-# INLINE _6 #-} + +instance Field6 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e,f',g,h,i) f f' where + _6 k ~(a,b,c,d,e,f,g,h,i) = (\f' -> (a,b,c,d,e,f',g,h,i)) <$> k f + {-# INLINE _6 #-} + +class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _7 :: Lens s t a b + +instance Field7 (a,b,c,d,e,f,g) (a,b,c,d,e,f,g') g g' where + _7 k ~(a,b,c,d,e,f,g) = (\g' -> (a,b,c,d,e,f,g')) <$> k g + {-# INLINE _7 #-} + +instance Field7 (a,b,c,d,e,f,g,h) (a,b,c,d,e,f,g',h) g g' where + _7 k ~(a,b,c,d,e,f,g,h) = (\g' -> (a,b,c,d,e,f,g',h)) <$> k g + {-# INLINE _7 #-} + +instance Field7 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e,f,g',h,i) g g' where + _7 k ~(a,b,c,d,e,f,g,h,i) = (\g' -> (a,b,c,d,e,f,g',h,i)) <$> k g + {-# INLINE _7 #-} + +class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _8 :: Lens s t a b + +instance Field8 (a,b,c,d,e,f,g,h) (a,b,c,d,e,f,g,h') h h' where + _8 k ~(a,b,c,d,e,f,g,h) = (\h' -> (a,b,c,d,e,f,g,h')) <$> k h + {-# INLINE _8 #-} + +instance Field8 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e,f,g,h',i) h h' where + _8 k ~(a,b,c,d,e,f,g,h,i) = (\h' -> (a,b,c,d,e,f,g,h',i)) <$> k h + {-# INLINE _8 #-} + +class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s where + _9 :: Lens s t a b + +instance Field9 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e,f,g,h,i') i i' where + _9 k ~(a,b,c,d,e,f,g,h,i) = (\i' -> (a,b,c,d,e,f,g,h,i')) <$> k i diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.14.0/src/Lens/Micro/Internal.hs new/microlens-0.5.0.0/src/Lens/Micro/Internal.hs --- old/microlens-0.4.14.0/src/Lens/Micro/Internal.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/microlens-0.5.0.0/src/Lens/Micro/Internal.hs 2001-09-09 03:46:40.000000000 +0200 @@ -43,11 +43,6 @@ Ixed(..), At(..), ixAt, - Field1(..), - Field2(..), - Field3(..), - Field4(..), - Field5(..), Cons(..), Snoc(..), Strict(..), @@ -366,217 +361,6 @@ {-# INLINE ix #-} #endif -class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where - {- | -Gives access to the 1st field of a tuple (up to 5-tuples). - -Getting the 1st component: - ->>> (1,2,3,4,5) ^. _1 -1 - -Setting the 1st component: - ->>> (1,2,3) & _1 .~ 10 -(10,2,3) - -Note that this lens is lazy, and can set fields even of 'undefined': - ->>> set _1 10 undefined :: (Int, Int) -(10,*** Exception: Prelude.undefined - -This is done to avoid violating a lens law stating that you can get back what you put: - ->>> view _1 . set _1 10 $ (undefined :: (Int, Int)) -10 - -The implementation (for 2-tuples) is: - -@ -'_1' f t = (,) '<$>' f ('fst' t) - '<*>' 'pure' ('snd' t) -@ - -or, alternatively, - -@ -'_1' f ~(a,b) = (\\a' -> (a',b)) '<$>' f a -@ - -(where @~@ means a <https://wiki.haskell.org/Lazy_pattern_match lazy pattern>). - -'_2', '_3', '_4', and '_5' are also available (see below). - -} - _1 :: Lens s t a b - -instance Field1 (a,b) (a',b) a a' where - _1 k ~(a,b) = (\a' -> (a',b)) <$> k a - {-# INLINE _1 #-} - -instance Field1 (a,b,c) (a',b,c) a a' where - _1 k ~(a,b,c) = (\a' -> (a',b,c)) <$> k a - {-# INLINE _1 #-} - -instance Field1 (a,b,c,d) (a',b,c,d) a a' where - _1 k ~(a,b,c,d) = (\a' -> (a',b,c,d)) <$> k a - {-# INLINE _1 #-} - -instance Field1 (a,b,c,d,e) (a',b,c,d,e) a a' where - _1 k ~(a,b,c,d,e) = (\a' -> (a',b,c,d,e)) <$> k a - {-# INLINE _1 #-} - -{- - -instance Field1 (a,b,c,d,e,f) (a',b,c,d,e,f) a a' where - _1 k ~(a,b,c,d,e,f) = (\a' -> (a',b,c,d,e,f)) <$> k a - {-# INLINE _1 #-} - -instance Field1 (a,b,c,d,e,f,g) (a',b,c,d,e,f,g) a a' where - _1 k ~(a,b,c,d,e,f,g) = (\a' -> (a',b,c,d,e,f,g)) <$> k a - {-# INLINE _1 #-} - -instance Field1 (a,b,c,d,e,f,g,h) (a',b,c,d,e,f,g,h) a a' where - _1 k ~(a,b,c,d,e,f,g,h) = (\a' -> (a',b,c,d,e,f,g,h)) <$> k a - {-# INLINE _1 #-} - -instance Field1 (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a' where - _1 k ~(a,b,c,d,e,f,g,h,i) = (\a' -> (a',b,c,d,e,f,g,h,i)) <$> k a - {-# INLINE _1 #-} - --} - -class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where - _2 :: Lens s t a b - -instance Field2 (a,b) (a,b') b b' where - _2 k ~(a,b) = (\b' -> (a,b')) <$> k b - {-# INLINE _2 #-} - -instance Field2 (a,b,c) (a,b',c) b b' where - _2 k ~(a,b,c) = (\b' -> (a,b',c)) <$> k b - {-# INLINE _2 #-} - -instance Field2 (a,b,c,d) (a,b',c,d) b b' where - _2 k ~(a,b,c,d) = (\b' -> (a,b',c,d)) <$> k b - {-# INLINE _2 #-} - -instance Field2 (a,b,c,d,e) (a,b',c,d,e) b b' where - _2 k ~(a,b,c,d,e) = (\b' -> (a,b',c,d,e)) <$> k b - {-# INLINE _2 #-} - -{- - -instance Field2 (a,b,c,d,e,f) (a,b',c,d,e,f) b b' where - _2 k ~(a,b,c,d,e,f) = (\b' -> (a,b',c,d,e,f)) <$> k b - {-# INLINE _2 #-} - -instance Field2 (a,b,c,d,e,f,g) (a,b',c,d,e,f,g) b b' where - _2 k ~(a,b,c,d,e,f,g) = (\b' -> (a,b',c,d,e,f,g)) <$> k b - {-# INLINE _2 #-} - -instance Field2 (a,b,c,d,e,f,g,h) (a,b',c,d,e,f,g,h) b b' where - _2 k ~(a,b,c,d,e,f,g,h) = (\b' -> (a,b',c,d,e,f,g,h)) <$> k b - {-# INLINE _2 #-} - -instance Field2 (a,b,c,d,e,f,g,h,i) (a,b',c,d,e,f,g,h,i) b b' where - _2 k ~(a,b,c,d,e,f,g,h,i) = (\b' -> (a,b',c,d,e,f,g,h,i)) <$> k b - {-# INLINE _2 #-} - --} - -class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where - _3 :: Lens s t a b - -instance Field3 (a,b,c) (a,b,c') c c' where - _3 k ~(a,b,c) = (\c' -> (a,b,c')) <$> k c - {-# INLINE _3 #-} - -instance Field3 (a,b,c,d) (a,b,c',d) c c' where - _3 k ~(a,b,c,d) = (\c' -> (a,b,c',d)) <$> k c - {-# INLINE _3 #-} - -instance Field3 (a,b,c,d,e) (a,b,c',d,e) c c' where - _3 k ~(a,b,c,d,e) = (\c' -> (a,b,c',d,e)) <$> k c - {-# INLINE _3 #-} - -{- - -instance Field3 (a,b,c,d,e,f) (a,b,c',d,e,f) c c' where - _3 k ~(a,b,c,d,e,f) = (\c' -> (a,b,c',d,e,f)) <$> k c - {-# INLINE _3 #-} - -instance Field3 (a,b,c,d,e,f,g) (a,b,c',d,e,f,g) c c' where - _3 k ~(a,b,c,d,e,f,g) = (\c' -> (a,b,c',d,e,f,g)) <$> k c - {-# INLINE _3 #-} - -instance Field3 (a,b,c,d,e,f,g,h) (a,b,c',d,e,f,g,h) c c' where - _3 k ~(a,b,c,d,e,f,g,h) = (\c' -> (a,b,c',d,e,f,g,h)) <$> k c - {-# INLINE _3 #-} - -instance Field3 (a,b,c,d,e,f,g,h,i) (a,b,c',d,e,f,g,h,i) c c' where - _3 k ~(a,b,c,d,e,f,g,h,i) = (\c' -> (a,b,c',d,e,f,g,h,i)) <$> k c - {-# INLINE _3 #-} - --} - -class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where - _4 :: Lens s t a b - -instance Field4 (a,b,c,d) (a,b,c,d') d d' where - _4 k ~(a,b,c,d) = (\d' -> (a,b,c,d')) <$> k d - {-# INLINE _4 #-} - -instance Field4 (a,b,c,d,e) (a,b,c,d',e) d d' where - _4 k ~(a,b,c,d,e) = (\d' -> (a,b,c,d',e)) <$> k d - {-# INLINE _4 #-} - -{- - -instance Field4 (a,b,c,d,e,f) (a,b,c,d',e,f) d d' where - _4 k ~(a,b,c,d,e,f) = (\d' -> (a,b,c,d',e,f)) <$> k d - {-# INLINE _4 #-} - -instance Field4 (a,b,c,d,e,f,g) (a,b,c,d',e,f,g) d d' where - _4 k ~(a,b,c,d,e,f,g) = (\d' -> (a,b,c,d',e,f,g)) <$> k d - {-# INLINE _4 #-} - -instance Field4 (a,b,c,d,e,f,g,h) (a,b,c,d',e,f,g,h) d d' where - _4 k ~(a,b,c,d,e,f,g,h) = (\d' -> (a,b,c,d',e,f,g,h)) <$> k d - {-# INLINE _4 #-} - -instance Field4 (a,b,c,d,e,f,g,h,i) (a,b,c,d',e,f,g,h,i) d d' where - _4 k ~(a,b,c,d,e,f,g,h,i) = (\d' -> (a,b,c,d',e,f,g,h,i)) <$> k d - {-# INLINE _4 #-} - --} - -class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where - _5 :: Lens s t a b - -instance Field5 (a,b,c,d,e) (a,b,c,d,e') e e' where - _5 k ~(a,b,c,d,e) = (\e' -> (a,b,c,d,e')) <$> k e - {-# INLINE _5 #-} - -{- - -instance Field5 (a,b,c,d,e,f) (a,b,c,d,e',f) e e' where - _5 k ~(a,b,c,d,e,f) = (\e' -> (a,b,c,d,e',f)) <$> k e - {-# INLINE _5 #-} - -instance Field5 (a,b,c,d,e,f,g) (a,b,c,d,e',f,g) e e' where - _5 k ~(a,b,c,d,e,f,g) = (\e' -> (a,b,c,d,e',f,g)) <$> k e - {-# INLINE _5 #-} - -instance Field5 (a,b,c,d,e,f,g,h) (a,b,c,d,e',f,g,h) e e' where - _5 k ~(a,b,c,d,e,f,g,h) = (\e' -> (a,b,c,d,e',f,g,h)) <$> k e - {-# INLINE _5 #-} - -instance Field5 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e',f,g,h,i) e e' where - _5 k ~(a,b,c,d,e,f,g,h,i) = (\e' -> (a,b,c,d,e',f,g,h,i)) <$> k e - {-# INLINE _5 #-} - --} - class Cons s t a b | s -> a, t -> b, s b -> t, t a -> s where _Cons :: Traversal s t (a,s) (b,t) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.14.0/src/Lens/Micro.hs new/microlens-0.5.0.0/src/Lens/Micro.hs --- old/microlens-0.4.14.0/src/Lens/Micro.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/microlens-0.5.0.0/src/Lens/Micro.hs 2001-09-09 03:46:40.000000000 +0200 @@ -80,7 +80,8 @@ Lens, Lens', lens, at, - _1, _2, _3, _4, _5, + -- _1, _2, _3, _4, _5, + module Lens.Micro.FieldN, -- * Iso: a lens that only changes the representation -- $isos-note @@ -115,7 +116,7 @@ ) where - +import Lens.Micro.FieldN import Lens.Micro.Type import Lens.Micro.Internal @@ -1623,3 +1624,215 @@ instance (Fail.MonadFail m) => Fail.MonadFail (StateT s m) where fail str = StateT $ \ _ -> Fail.fail str #endif + + +-- class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where +-- {- | +-- Gives access to the 1st field of a tuple (up to 5-tuples). + +-- Getting the 1st component: + +-- >>> (1,2,3,4,5) ^. _1 +-- 1 + +-- Setting the 1st component: + +-- >>> (1,2,3) & _1 .~ 10 +-- (10,2,3) + +-- Note that this lens is lazy, and can set fields even of 'undefined': + +-- >>> set _1 10 undefined :: (Int, Int) +-- (10,*** Exception: Prelude.undefined + +-- This is done to avoid violating a lens law stating that you can get back what you put: + +-- >>> view _1 . set _1 10 $ (undefined :: (Int, Int)) +-- 10 + +-- The implementation (for 2-tuples) is: + +-- @ +-- '_1' f t = (,) '<$>' f ('fst' t) +-- '<*>' 'pure' ('snd' t) +-- @ + +-- or, alternatively, + +-- @ +-- '_1' f ~(a,b) = (\\a' -> (a',b)) '<$>' f a +-- @ + +-- (where @~@ means a <https://wiki.haskell.org/Lazy_pattern_match lazy pattern>). + +-- '_2', '_3', '_4', and '_5' are also available (see below). +-- -} +-- _1 :: Lens s t a b + +-- instance Field1 (a,b) (a',b) a a' where +-- _1 k ~(a,b) = (\a' -> (a',b)) <$> k a +-- {-# INLINE _1 #-} + +-- instance Field1 (a,b,c) (a',b,c) a a' where +-- _1 k ~(a,b,c) = (\a' -> (a',b,c)) <$> k a +-- {-# INLINE _1 #-} + +-- instance Field1 (a,b,c,d) (a',b,c,d) a a' where +-- _1 k ~(a,b,c,d) = (\a' -> (a',b,c,d)) <$> k a +-- {-# INLINE _1 #-} + +-- instance Field1 (a,b,c,d,e) (a',b,c,d,e) a a' where +-- _1 k ~(a,b,c,d,e) = (\a' -> (a',b,c,d,e)) <$> k a +-- {-# INLINE _1 #-} + +-- {- + +-- instance Field1 (a,b,c,d,e,f) (a',b,c,d,e,f) a a' where +-- _1 k ~(a,b,c,d,e,f) = (\a' -> (a',b,c,d,e,f)) <$> k a +-- {-# INLINE _1 #-} + +-- instance Field1 (a,b,c,d,e,f,g) (a',b,c,d,e,f,g) a a' where +-- _1 k ~(a,b,c,d,e,f,g) = (\a' -> (a',b,c,d,e,f,g)) <$> k a +-- {-# INLINE _1 #-} + +-- instance Field1 (a,b,c,d,e,f,g,h) (a',b,c,d,e,f,g,h) a a' where +-- _1 k ~(a,b,c,d,e,f,g,h) = (\a' -> (a',b,c,d,e,f,g,h)) <$> k a +-- {-# INLINE _1 #-} + +-- instance Field1 (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a' where +-- _1 k ~(a,b,c,d,e,f,g,h,i) = (\a' -> (a',b,c,d,e,f,g,h,i)) <$> k a +-- {-# INLINE _1 #-} + +-- -} + +-- class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where +-- _2 :: Lens s t a b + +-- instance Field2 (a,b) (a,b') b b' where +-- _2 k ~(a,b) = (\b' -> (a,b')) <$> k b +-- {-# INLINE _2 #-} + +-- instance Field2 (a,b,c) (a,b',c) b b' where +-- _2 k ~(a,b,c) = (\b' -> (a,b',c)) <$> k b +-- {-# INLINE _2 #-} + +-- instance Field2 (a,b,c,d) (a,b',c,d) b b' where +-- _2 k ~(a,b,c,d) = (\b' -> (a,b',c,d)) <$> k b +-- {-# INLINE _2 #-} + +-- instance Field2 (a,b,c,d,e) (a,b',c,d,e) b b' where +-- _2 k ~(a,b,c,d,e) = (\b' -> (a,b',c,d,e)) <$> k b +-- {-# INLINE _2 #-} + +-- {- + +-- instance Field2 (a,b,c,d,e,f) (a,b',c,d,e,f) b b' where +-- _2 k ~(a,b,c,d,e,f) = (\b' -> (a,b',c,d,e,f)) <$> k b +-- {-# INLINE _2 #-} + +-- instance Field2 (a,b,c,d,e,f,g) (a,b',c,d,e,f,g) b b' where +-- _2 k ~(a,b,c,d,e,f,g) = (\b' -> (a,b',c,d,e,f,g)) <$> k b +-- {-# INLINE _2 #-} + +-- instance Field2 (a,b,c,d,e,f,g,h) (a,b',c,d,e,f,g,h) b b' where +-- _2 k ~(a,b,c,d,e,f,g,h) = (\b' -> (a,b',c,d,e,f,g,h)) <$> k b +-- {-# INLINE _2 #-} + +-- instance Field2 (a,b,c,d,e,f,g,h,i) (a,b',c,d,e,f,g,h,i) b b' where +-- _2 k ~(a,b,c,d,e,f,g,h,i) = (\b' -> (a,b',c,d,e,f,g,h,i)) <$> k b +-- {-# INLINE _2 #-} + +-- -} + +-- class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where +-- _3 :: Lens s t a b + +-- instance Field3 (a,b,c) (a,b,c') c c' where +-- _3 k ~(a,b,c) = (\c' -> (a,b,c')) <$> k c +-- {-# INLINE _3 #-} + +-- instance Field3 (a,b,c,d) (a,b,c',d) c c' where +-- _3 k ~(a,b,c,d) = (\c' -> (a,b,c',d)) <$> k c +-- {-# INLINE _3 #-} + +-- instance Field3 (a,b,c,d,e) (a,b,c',d,e) c c' where +-- _3 k ~(a,b,c,d,e) = (\c' -> (a,b,c',d,e)) <$> k c +-- {-# INLINE _3 #-} + +-- {- + +-- instance Field3 (a,b,c,d,e,f) (a,b,c',d,e,f) c c' where +-- _3 k ~(a,b,c,d,e,f) = (\c' -> (a,b,c',d,e,f)) <$> k c +-- {-# INLINE _3 #-} + +-- instance Field3 (a,b,c,d,e,f,g) (a,b,c',d,e,f,g) c c' where +-- _3 k ~(a,b,c,d,e,f,g) = (\c' -> (a,b,c',d,e,f,g)) <$> k c +-- {-# INLINE _3 #-} + +-- instance Field3 (a,b,c,d,e,f,g,h) (a,b,c',d,e,f,g,h) c c' where +-- _3 k ~(a,b,c,d,e,f,g,h) = (\c' -> (a,b,c',d,e,f,g,h)) <$> k c +-- {-# INLINE _3 #-} + +-- instance Field3 (a,b,c,d,e,f,g,h,i) (a,b,c',d,e,f,g,h,i) c c' where +-- _3 k ~(a,b,c,d,e,f,g,h,i) = (\c' -> (a,b,c',d,e,f,g,h,i)) <$> k c +-- {-# INLINE _3 #-} + +-- -} + +-- class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where +-- _4 :: Lens s t a b + +-- instance Field4 (a,b,c,d) (a,b,c,d') d d' where +-- _4 k ~(a,b,c,d) = (\d' -> (a,b,c,d')) <$> k d +-- {-# INLINE _4 #-} + +-- instance Field4 (a,b,c,d,e) (a,b,c,d',e) d d' where +-- _4 k ~(a,b,c,d,e) = (\d' -> (a,b,c,d',e)) <$> k d +-- {-# INLINE _4 #-} + +-- {- + +-- instance Field4 (a,b,c,d,e,f) (a,b,c,d',e,f) d d' where +-- _4 k ~(a,b,c,d,e,f) = (\d' -> (a,b,c,d',e,f)) <$> k d +-- {-# INLINE _4 #-} + +-- instance Field4 (a,b,c,d,e,f,g) (a,b,c,d',e,f,g) d d' where +-- _4 k ~(a,b,c,d,e,f,g) = (\d' -> (a,b,c,d',e,f,g)) <$> k d +-- {-# INLINE _4 #-} + +-- instance Field4 (a,b,c,d,e,f,g,h) (a,b,c,d',e,f,g,h) d d' where +-- _4 k ~(a,b,c,d,e,f,g,h) = (\d' -> (a,b,c,d',e,f,g,h)) <$> k d +-- {-# INLINE _4 #-} + +-- instance Field4 (a,b,c,d,e,f,g,h,i) (a,b,c,d',e,f,g,h,i) d d' where +-- _4 k ~(a,b,c,d,e,f,g,h,i) = (\d' -> (a,b,c,d',e,f,g,h,i)) <$> k d +-- {-# INLINE _4 #-} + +-- -} + +-- class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where +-- _5 :: Lens s t a b + +-- instance Field5 (a,b,c,d,e) (a,b,c,d,e') e e' where +-- _5 k ~(a,b,c,d,e) = (\e' -> (a,b,c,d,e')) <$> k e +-- {-# INLINE _5 #-} + +-- {- + +-- instance Field5 (a,b,c,d,e,f) (a,b,c,d,e',f) e e' where +-- _5 k ~(a,b,c,d,e,f) = (\e' -> (a,b,c,d,e',f)) <$> k e +-- {-# INLINE _5 #-} + +-- instance Field5 (a,b,c,d,e,f,g) (a,b,c,d,e',f,g) e e' where +-- _5 k ~(a,b,c,d,e,f,g) = (\e' -> (a,b,c,d,e',f,g)) <$> k e +-- {-# INLINE _5 #-} + +-- instance Field5 (a,b,c,d,e,f,g,h) (a,b,c,d,e',f,g,h) e e' where +-- _5 k ~(a,b,c,d,e,f,g,h) = (\e' -> (a,b,c,d,e',f,g,h)) <$> k e +-- {-# INLINE _5 #-} + +-- instance Field5 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e',f,g,h,i) e e' where +-- _5 k ~(a,b,c,d,e,f,g,h,i) = (\e' -> (a,b,c,d,e',f,g,h,i)) <$> k e +-- {-# INLINE _5 #-} + +-- -}
