commit ghc-microlens for openSUSE:Factory
("hello", "goodbye") & both <>~ " world!" ("hello world!", "goodbye world!")
Hello community, here is the log from the commit of package ghc-microlens for openSUSE:Factory checked in at 2019-06-30 10:21:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-microlens (Old) and /work/SRC/openSUSE:Factory/.ghc-microlens.new.4615 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-microlens" Sun Jun 30 10:21:36 2019 rev:13 rq:712504 version:0.4.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-microlens/ghc-microlens.changes 2018-12-24 11:37:30.637658788 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-microlens.new.4615/ghc-microlens.changes 2019-06-30 10:21:38.735633643 +0200 @@ -1,0 +2,17 @@ +Fri Jun 21 02:02:59 UTC 2019 - psimons@suse.com + +- Update microlens to version 0.4.11.1. + # 0.4.11.1 + + * Reverted marking `Lens.Micro.Internal` as `Trustworthy`, see [#122](https://github.com/monadfix/microlens/issues/122). + +------------------------------------------------------------------- +Wed Jun 19 11:46:02 UTC 2019 - psimons@suse.com + +- Update microlens to version 0.4.11. + Upstream has edited the change log file since the last release in + a non-trivial way, i.e. they did more than just add a new entry + at the top. You can review the file at: + http://hackage.haskell.org/package/microlens-0.4.11/src/CHANGELOG.md + +------------------------------------------------------------------- Old: ---- microlens-0.4.10.tar.gz New: ---- microlens-0.4.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-microlens.spec ++++++ --- /var/tmp/diff_new_pack.fBBrsg/_old 2019-06-30 10:21:39.263634464 +0200 +++ /var/tmp/diff_new_pack.fBBrsg/_new 2019-06-30 10:21:39.267634470 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-microlens # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,9 +18,9 @@ %global pkg_name microlens Name: ghc-%{pkg_name} -Version: 0.4.10 +Version: 0.4.11.1 Release: 0 -Summary: Tiny lens library for Haskell +Summary: A tiny lens library with no dependencies License: BSD-3-Clause Group: Development/Libraries/Haskell URL: https://hackage.haskell.org/package/%{pkg_name} @@ -29,12 +29,6 @@ BuildRequires: ghc-rpm-macros %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!). - This library is an extract from <http://hackage.haskell.org/package/lens lens> (with no dependencies). It's not a toy lenses library, unsuitable for “real world”, but merely a small one. It is compatible with lens, and should have ++++++ microlens-0.4.10.tar.gz -> microlens-0.4.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.10/CHANGELOG.md new/microlens-0.4.11.1/CHANGELOG.md --- old/microlens-0.4.10/CHANGELOG.md 2018-11-03 12:53:50.000000000 +0100 +++ new/microlens-0.4.11.1/CHANGELOG.md 2019-06-20 07:46:05.000000000 +0200 @@ -1,3 +1,14 @@ +# 0.4.11.1 + +* Reverted marking `Lens.Micro.Internal` as `Trustworthy`, see [#122](https://github.com/monadfix/microlens/issues/122). + +# 0.4.11 + +* Added fixity declarations for `+~` and `-~` (thanks to Francesco Ariis). +* Added `rewriteOf` and `transformOf` (thanks to @quasicomputational). +* Added an instance `Each (Either a a) (Either b b) a b`, following `lens`'s suit. +* Marked `Lens.Micro.Internal` as `Trustworthy` starting from GHC 7.8. + # 0.4.10 * Added `+~` and `-~`. @@ -95,7 +106,7 @@ # 0.3.4.1 -* Changed the description of the package from “A tiny part of the lens library which you can depend upon” to “A tiny part of the lens library with no dependencies” because the previous one was ambiguous (I admit I kinda liked that ambiguity, tho). +* Changed the description of the package from “A tiny part of the lens library which you can depend upon” to “A tiny part of the lens library with no dependencies” because the previous one was ambiguous (I admit I kinda liked that ambiguity, though). # 0.3.4.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.10/microlens.cabal new/microlens-0.4.11.1/microlens.cabal --- old/microlens-0.4.10/microlens.cabal 2018-11-03 12:54:15.000000000 +0100 +++ new/microlens-0.4.11.1/microlens.cabal 2019-06-20 07:46:10.000000000 +0200 @@ -1,6 +1,6 @@ name: microlens -version: 0.4.10 -synopsis: A tiny lens library with no dependencies. If you're writing an app, you probably want microlens-platform, not this. +version: 0.4.11.1 +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!). . @@ -18,7 +18,7 @@ . However, don't use this library if: . - * You need @Iso@s, @Prism@s, indexed traversals, or actually anything else which isn't defined here (tho some indexed functions are available elsewhere – containers and vector provide them for their types, and <http://hackage.haskell.org/package/ilist ilist> provides indexed functions for lists). + * You need @Iso@s, @Prism@s, indexed traversals, or actually anything else which isn't defined here (though some indexed functions are available elsewhere – containers and vector provide them for their types, and <http://hackage.haskell.org/package/ilist ilist> provides indexed functions for lists). . * You want a library with a clean, understandable implementation (in which case you're looking for <http://hackage.haskell.org/package/lens-simple lens-simple>). . @@ -41,6 +41,14 @@ extra-source-files: CHANGELOG.md cabal-version: >=1.10 +tested-with: GHC==7.4.2 + GHC==7.6.3 + GHC==7.8.4 + GHC==7.10.3 + GHC==8.0.2 + GHC==8.2.2 + GHC==8.4.4 + GHC==8.6.4 source-repository head type: git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.10/src/Lens/Micro/Internal.hs new/microlens-0.4.11.1/src/Lens/Micro/Internal.hs --- old/microlens-0.4.10/src/Lens/Micro/Internal.hs 2018-11-03 12:52:00.000000000 +0100 +++ new/microlens-0.4.11.1/src/Lens/Micro/Internal.hs 2019-06-18 23:48:44.000000000 +0200 @@ -10,8 +10,9 @@ {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ImplicitParams #-} -{-# LANGUAGE Unsafe #-} +-- Note: this module is marked 'Unsafe' because it exports (#.), which is essentially 'coerce', and Data.Coerce is marked 'Unsafe' in base. As per <https://github.com/ekmett/lens/issues/661>, this is an issue for 'lens' as well but they have opted for 'Trustworthy' instead. +{-# LANGUAGE Unsafe #-} {- | Module : Lens.Micro.Internal @@ -156,6 +157,10 @@ -- Data.Profunctor.Unsafe ------------------------------------------------------------------------------ +-- Note: 'lens' defines a type-restricted version of (#.) to work around a +-- bug, but our version is restricted enough that we don't need it. See +-- <https://github.com/ekmett/lens/commit/cde2fc39c0dba413d1a6f814b47bd14431a5e339> + #if __GLASGOW_HASKELL__ >= 708 ( #. ) :: Coercible c b => (b -> c) -> (a -> b) -> (a -> c) ( #. ) _ = coerce (\x -> x :: b) :: forall a b. Coercible b a => a -> b @@ -198,6 +203,7 @@ 'each' :: 'Traversal' [a] [b] a b 'each' :: 'Traversal' ('Maybe' a) ('Maybe' b) a b +'each' :: 'Traversal' ('Either' a a) ('Either' b b) a b -- since 0.4.11 'each' :: 'Traversal' (a,a) (b,b) a b 'each' :: 'Traversal' (a,a,a) (b,b,b) a b @@ -239,12 +245,22 @@ each = traverse {-# INLINE each #-} +{- | +@since 0.4.11 +-} +instance (a~a', b~b') => Each (Either a a') (Either b b') a b where + each f (Left a) = Left <$> f a + each f (Right a ) = Right <$> f a + {-# INLINE each #-} + #if __GLASGOW_HASKELL__ >= 800 instance Each (NonEmpty a) (NonEmpty b) a b where each = traversed {-# INLINE each #-} #endif +-- NOTE: when adding new instances of 'Each', update the docs for 'each'. + type family Index (s :: *) :: * type family IxValue (m :: *) :: * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microlens-0.4.10/src/Lens/Micro.hs new/microlens-0.4.11.1/src/Lens/Micro.hs --- old/microlens-0.4.10/src/Lens/Micro.hs 2018-11-03 12:51:53.000000000 +0100 +++ new/microlens-0.4.11.1/src/Lens/Micro.hs 2019-06-18 01:03:47.000000000 +0200 @@ -44,6 +44,8 @@ (?~), (<%~), (<<%~), (<<.~), mapped, + rewriteOf, + transformOf, -- * Getter: extracts a value from a structure -- $getters-note @@ -112,7 +114,12 @@ import Data.Maybe import Data.Tuple import qualified Data.Foldable as F + +#if __GLASGOW_HASKELL__ >= 708 +import Data.Coerce +#else import Unsafe.Coerce +#endif #if MIN_VERSION_base(4,8,0) import Data.Function ((&)) @@ -304,57 +311,69 @@ {-# INLINE over #-} --- | Increment the target(s) of a numerically valued 'Lens' or 'Traversal'. --- --- >>> (a,b) & _1 +~ c --- (a + c,b) --- --- >>> (a,b) & both +~ c --- (a + c,b + c) --- --- >>> (1,2) & _2 +~ 1 --- (1,3) --- --- >>> [(a,b),(c,d)] & traverse.both +~ e --- [(a + e,b + e),(c + e,d + e)] --- --- @ --- ('+~') :: 'Num' a => 'Lens'' s a -> a -> s -> s --- ('+~') :: 'Num' a => 'Traversal'' s a -> a -> s -> s --- @ +{- | +Increment the target(s) of a numerically valued 'Lens' or 'Traversal'. + +>>> (a,b) & _1 +~ c +(a + c,b) + +>>> (a,b) & both +~ c +(a + c,b + c) + +>>> (1,2) & _2 +~ 1 +(1,3) + +>>> [(a,b),(c,d)] & traverse.both +~ e +[(a + e,b + e),(c + e,d + e)] + +@ +('+~') :: 'Num' a => 'Lens'' s a -> a -> s -> s +('+~') :: 'Num' a => 'Traversal'' s a -> a -> s -> s +@ + +@since 0.4.10 +-} (+~) :: Num a => ASetter s t a a -> a -> s -> t l +~ n = over l (+ n) {-# INLINE (+~) #-} --- | Decrement the target(s) of a numerically valued 'Lens', or 'Traversal'. --- --- >>> (a,b) & _1 -~ c --- (a - c,b) --- --- >>> (a,b) & both -~ c --- (a - c,b - c) --- --- >>> _1 -~ 2 $ (1,2) --- (-1,2) --- --- >>> mapped.mapped -~ 1 $ [[4,5],[6,7]] --- [[3,4],[5,6]] --- --- @ --- ('-~') :: 'Num' a => 'Lens'' s a -> a -> s -> s --- ('-~') :: 'Num' a => 'Traversal'' s a -> a -> s -> s --- @ +infixr 4 +~ + +{- | +Decrement the target(s) of a numerically valued 'Lens', or 'Traversal'. + +>>> (a,b) & _1 -~ c +(a - c,b) + +>>> (a,b) & both -~ c +(a - c,b - c) + +>>> _1 -~ 2 $ (1,2) +(-1,2) + +>>> mapped.mapped -~ 1 $ [[4,5],[6,7]] +[[3,4],[5,6]] + +@ +('-~') :: 'Num' a => 'Lens'' s a -> a -> s -> s +('-~') :: 'Num' a => 'Traversal'' s a -> a -> s -> s +@ + +@since 0.4.10 +-} (-~) :: Num a => ASetter s t a a -> a -> s -> t l -~ n = over l (subtract n) {-# INLINE (-~) #-} - +infixr 4 -~ {- | ('<>~') appends a value monoidally to the target. + +@since 0.4.9 -} (<>~) :: (Monoid a) => ASetter s t a a -> a -> s -> t (<>~) l a = over l (`mappend` a) @@ -498,6 +517,30 @@ infixr 4 <<.~ +{- | +→ See <https://github.com/monadfix/microlens/pull/119#issuecomment-496004851 an example> on GitHub. + +Rewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result. + +Usually 'transformOf' is more appropriate, but 'rewriteOf' can give better compositionality. Given two single transformations @f@ and @g@, you can construct @\\a -> f a '<|>' g a@ which performs both rewrites until a fixed point. + +@since 0.4.11 +-} +rewriteOf :: ASetter a b a b -> (b -> Maybe a) -> a -> b +rewriteOf l f = go where + go = transformOf l (\x -> maybe x go (f x)) +{-# INLINE rewriteOf #-} + +{- | +Transform every element by recursively applying a given 'ASetter' in a bottom-up manner. + +@since 0.4.11 +-} +transformOf :: ASetter a b a b -> (b -> b) -> a -> b +transformOf l f = go where + go = f . over l go +{-# INLINE transformOf #-} + -- Getting ----------------------------------------------------------------- {- $getters-note @@ -1015,8 +1058,13 @@ where Bazaar b = l sell s sell w = Bazaar ($ w) +#if __GLASGOW_HASKELL__ >= 708 + ins f = (coerce :: [Identity a] -> [a]) + (getConst (f (\ra -> Const [Identity ra]))) +#else ins f = (unsafeCoerce :: [Identity a] -> [a]) (getConst (f (\ra -> Const [Identity ra]))) +#endif unsafeOuts f = evalState (f (\_ -> state (unconsWithDefault fakeVal))) where fakeVal = error "unsafeOuts: not enough elements were supplied" unconsWithDefault d [] = (d,[])
participants (1)
-
root