Hello community,

here is the log from the commit of package ghc-microlens for openSUSE:Factory 
checked in at 2016-07-05 09:52:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-microlens (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-microlens.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-microlens"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-microlens/ghc-microlens.changes      
2016-06-14 23:08:29.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-microlens.new/ghc-microlens.changes 
2016-07-05 09:52:53.000000000 +0200
@@ -1,0 +2,6 @@
+Sun Jul  3 12:15:00 UTC 2016 - mimi...@gmail.com
+
+- update to 0.4.5.0
+* Added <&> (which makes lens creation easier).
+
+-------------------------------------------------------------------

Old:
----
  microlens-0.4.4.3.tar.gz

New:
----
  microlens-0.4.5.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-microlens.spec ++++++
--- /var/tmp/diff_new_pack.JzS0UW/_old  2016-07-05 09:52:54.000000000 +0200
+++ /var/tmp/diff_new_pack.JzS0UW/_new  2016-07-05 09:52:54.000000000 +0200
@@ -18,7 +18,7 @@
 %global pkg_name microlens
 
 Name:           ghc-%{pkg_name}
-Version:        0.4.4.3
+Version:        0.4.5.0
 Release:        0
 Summary:        A tiny part of the lens library with no dependencies
 Group:          System/Libraries

++++++ microlens-0.4.4.3.tar.gz -> microlens-0.4.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/microlens-0.4.4.3/CHANGELOG.md 
new/microlens-0.4.5.0/CHANGELOG.md
--- old/microlens-0.4.4.3/CHANGELOG.md  2016-06-11 13:09:05.000000000 +0200
+++ new/microlens-0.4.5.0/CHANGELOG.md  2016-07-02 18:34:58.000000000 +0200
@@ -1,3 +1,7 @@
+# 0.4.5.0
+
+* Added `<&>` (which makes lens creation easier).
+
 # 0.4.4.3
 
 * Fixed markup in the .cabal file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/microlens-0.4.4.3/microlens.cabal 
new/microlens-0.4.5.0/microlens.cabal
--- old/microlens-0.4.4.3/microlens.cabal       2016-06-11 13:09:05.000000000 
+0200
+++ new/microlens-0.4.5.0/microlens.cabal       2016-07-02 18:34:58.000000000 
+0200
@@ -1,5 +1,5 @@
 name:                microlens
-version:             0.4.4.3
+version:             0.4.5.0
 synopsis:            A tiny lens library with no dependencies. If you're 
writing an app, you probably want microlens-platform, not this.
 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!).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/microlens-0.4.4.3/src/Lens/Micro.hs 
new/microlens-0.4.5.0/src/Lens/Micro.hs
--- old/microlens-0.4.4.3/src/Lens/Micro.hs     2016-06-11 13:09:05.000000000 
+0200
+++ new/microlens-0.4.5.0/src/Lens/Micro.hs     2016-07-02 18:34:58.000000000 
+0200
@@ -32,6 +32,7 @@
 (
   (&),
   -- $ampersand-note
+  (<&>),
 
   -- * Setter: modifies something in a structure
   -- $setters-note
@@ -155,6 +156,35 @@
 @
 -}
 
+{- |
+('<&>') is flipped ('<$>'):
+
+@
+x '<&>' f = f '<$>' x
+@
+
+It's often useful when writing lenses. For instance, let's say you're writing 
'ix' for @Map@; if the key is found in the map, you have to apply a function to 
it and then change the map based on the new value – which requires a lambda, 
like this:
+
+@
+'ix' key f map = case Map.lookup key map of
+     Just val -> (\\val' -> Map.insert key val' map) '<$>' f val
+     Nothing  -> 'pure' map
+@
+
+With ('<&>') you can get rid of parentheses and move the long lambda 
expression to the right of the value (like when you use '>>='):
+
+@
+'ix' key f map = case Map.lookup key map of
+     Just val -> f val '<&>' \\val' -> Map.insert key val' map
+     Nothing  -> 'pure' map
+@
+-}
+(<&>) :: Functor f => f a -> (a -> b) -> f b
+(<&>) x f = f <$> x
+{-# INLINE (<&>) #-}
+
+infixl 1 <&>
+
 -- Setting -----------------------------------------------------------------
 
 {- $setters-note
@@ -795,7 +825,9 @@
 filtered p s = if p s then f s else 'pure' s
 @
 
-By the way, note that 'filtered' can generate illegal traversals – sometimes 
this can bite you. For instance, take @evens@:
+By the way, note that 'filtered' can generate illegal traversals – sometimes 
this can bite you. In particular, an optimisation that should be safe becomes 
unsafe. (To the best of my knowledge, this optimisation never happens 
automatically. If you just use 'filtered' to modify/view something, you're 
safe. If you don't define any traversals that use 'filtered', you're safe too.)
+
+Let's use @evens@ as an example:
 
 @
 evens = 'filtered' 'even'
@@ -813,7 +845,7 @@
 
   * the right-side variant applies @f@ and @g@ to all even numbers
 
-Of course, when you are careful and know what you're doing, you won't try to 
make such an optimisation. However, if you export an illegal traversal created 
with 'filtered' and someone tries to use it, ne might mistakenly assume that 
it's legal, do the optimisation, and silently get an incorrect result.
+Of course, when you are careful and know what you're doing, you won't try to 
make such an optimisation. However, if you export an illegal traversal created 
with 'filtered' and someone tries to use it, they might mistakenly assume that 
it's legal, do the optimisation, and silently get an incorrect result.
 
 If you are using 'filtered' with some another traversal that doesn't overlap 
with -whatever the predicate checks-, the resulting traversal will be legal. 
For instance, here the predicate looks at the 1st element of a tuple, but the 
resulting traversal only gives you access to the 2nd:
 


Reply via email to