microlens 0.4.9.1 → 0.4.10
raw patch · 7 files changed
+74/−18 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Lens.Micro.Internal: instance (a ~ b, a ~ c, a ~ d, a ~ e, q ~ r, q ~ s, q ~ t, q ~ u) => Lens.Micro.Internal.Each (a, b, c, d, e) (q, r, s, t, u) a q
- Lens.Micro.Internal: instance (a ~ b, a ~ c, a ~ d, q ~ r, q ~ s, q ~ t) => Lens.Micro.Internal.Each (a, b, c, d) (q, r, s, t) a q
- Lens.Micro.Internal: instance (a ~ b, a ~ c, q ~ r, q ~ s) => Lens.Micro.Internal.Each (a, b, c) (q, r, s) a q
- Lens.Micro.Internal: instance (a ~ b, q ~ r) => Lens.Micro.Internal.Each (a, b) (q, r) a q
- Lens.Micro.Internal: instance Lens.Micro.Internal.Each (Data.List.NonEmpty.NonEmpty a) (Data.List.NonEmpty.NonEmpty b) a b
- Lens.Micro.Internal: instance Lens.Micro.Internal.Each (GHC.Base.Maybe a) (GHC.Base.Maybe b) a b
+ Lens.Micro: (+~) :: Num a => ASetter s t a a -> a -> s -> t
+ Lens.Micro: (-~) :: Num a => ASetter s t a a -> a -> s -> t
+ Lens.Micro: instance GHC.Base.Applicative f => GHC.Base.Semigroup (Lens.Micro.Traversed a f)
+ Lens.Micro.Internal: instance (a Data.Type.Equality.~ b, a Data.Type.Equality.~ c, a Data.Type.Equality.~ d, a Data.Type.Equality.~ e, q Data.Type.Equality.~ r, q Data.Type.Equality.~ s, q Data.Type.Equality.~ t, q Data.Type.Equality.~ u) => Lens.Micro.Internal.Each (a, b, c, d, e) (q, r, s, t, u) a q
+ Lens.Micro.Internal: instance (a Data.Type.Equality.~ b, a Data.Type.Equality.~ c, a Data.Type.Equality.~ d, q Data.Type.Equality.~ r, q Data.Type.Equality.~ s, q Data.Type.Equality.~ t) => Lens.Micro.Internal.Each (a, b, c, d) (q, r, s, t) a q
+ Lens.Micro.Internal: instance (a Data.Type.Equality.~ b, a Data.Type.Equality.~ c, q Data.Type.Equality.~ r, q Data.Type.Equality.~ s) => Lens.Micro.Internal.Each (a, b, c) (q, r, s) a q
+ Lens.Micro.Internal: instance (a Data.Type.Equality.~ b, q Data.Type.Equality.~ r) => Lens.Micro.Internal.Each (a, b) (q, r) a q
+ Lens.Micro.Internal: instance Lens.Micro.Internal.Each (GHC.Base.NonEmpty a) (GHC.Base.NonEmpty b) a b
+ Lens.Micro.Internal: instance Lens.Micro.Internal.Each (GHC.Maybe.Maybe a) (GHC.Maybe.Maybe b) a b
+ Lens.Micro.Internal: type family IxValue (m :: *) :: *
- Lens.Micro: (<>~) :: (Monoid a) => ASetter s t a a -> a -> s -> t
+ Lens.Micro: (<>~) :: Monoid a => ASetter s t a a -> a -> s -> t
- Lens.Micro.Internal: (#.) :: Coercible c b => (b -> c) -> (a -> b) -> (a -> c)
+ Lens.Micro.Internal: (#.) :: Coercible c b => (b -> c) -> (a -> b) -> a -> c
- Lens.Micro.Internal: (.#) :: Coercible b a => (b -> c) -> (a -> b) -> (a -> c)
+ Lens.Micro.Internal: (.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c
Files
- CHANGELOG.md +6/−1
- LICENSE +3/−2
- microlens.cabal +10/−10
- src/Lens/Micro.hs +49/−2
- src/Lens/Micro/Extras.hs +1/−1
- src/Lens/Micro/Internal.hs +4/−1
- src/Lens/Micro/Type.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.4.10++* Added `+~` and `-~`.+* Marked `#.` and `.#` with `INLINE`.+ # 0.4.9.1 * Reexported `<&>` from `Data.Functor` (on recent versions of `base`).@@ -26,7 +31,7 @@ # 0.4.7.0 -* Fixed the [Haddock crash on GHC 8](https://github.com/aelve/microlens/issues/72) by removing default method implementations (`each = traverse` and `ix = ixAt`). If you had custom instances of `Ixed` or `Each` which relied on default methods, they'd stop working.+* Fixed the [Haddock crash on GHC 8](https://github.com/monadfix/microlens/issues/72) by removing default method implementations (`each = traverse` and `ix = ixAt`). If you had custom instances of `Ixed` or `Each` which relied on default methods, they'd stop working. # 0.4.6.0
LICENSE view
@@ -1,5 +1,6 @@ Copyright (c) 2013-2016 Edward Kmett,- 2015-2016 Artyom+ 2015-2016 Artyom Kazak,+ 2018 Monadfix All rights reserved. @@ -14,7 +15,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Artyom nor the names of other+ * Neither the name of Monadfix nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.
microlens.cabal view
@@ -1,12 +1,12 @@ name: microlens-version: 0.4.9.1+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. 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 same performance. It also has better documentation. .- There's a longer readme <https://github.com/aelve/microlens#readme on Github>. It has a migration guide for lens users, a description of other packages in the family, a discussion of other lens libraries you could use instead, and so on.+ There's a longer readme <https://github.com/monadfix/microlens#readme on Github>. It has a migration guide for lens users, a description of other packages in the family, a discussion of other lens libraries you could use instead, and so on. . Here are some usecases for this library: .@@ -31,11 +31,11 @@ Note that microlens has no dependencies starting from GHC 7.10 (base-4.8). Prior to that, it depends on transformers-0.2 or above. license: BSD3 license-file: LICENSE-author: Edward Kmett, Artyom-maintainer: Artyom <yom@artyom.me>-homepage: http://github.com/aelve/microlens-bug-reports: http://github.com/aelve/microlens/issues--- copyright: +author: Edward Kmett, Artyom Kazak+maintainer: Monadfix <hi@monadfix.io>+homepage: http://github.com/monadfix/microlens+bug-reports: http://github.com/monadfix/microlens/issues+-- copyright: category: Data, Lenses build-type: Simple extra-source-files:@@ -44,15 +44,15 @@ source-repository head type: git- location: git://github.com/aelve/microlens.git+ location: git://github.com/monadfix/microlens.git library exposed-modules: Lens.Micro Lens.Micro.Extras Lens.Micro.Internal Lens.Micro.Type- -- other-modules: - -- other-extensions: + -- other-modules:+ -- other-extensions: -- Since base-4.8 we get the Identity functor in base, so we can avoid a -- transformers dependency.
src/Lens/Micro.hs view
@@ -11,7 +11,7 @@ {- | Module : Lens.Micro-Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom+Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom Kazak, 2018 Monadfix License : BSD-style (see the file LICENSE) This module provides the essential functionality. There are other packages in the microlens family – mix and match them at will. If you're writing an app, you want <http://hackage.haskell.org/package/microlens-platform microlens-platform> – it provides the most functionality.@@ -38,7 +38,7 @@ -- $setters-note ASetter, ASetter', sets,- (%~), over,+ (%~), over, (+~), (-~), (<>~), (.~), set, (?~),@@ -302,6 +302,53 @@ over :: ASetter s t a b -> (a -> b) -> s -> t over l f = runIdentity #. l (Identity #. f) {-# 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+-- @+(+~) :: 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+-- @+(-~) :: Num a => ASetter s t a a -> a -> s -> t+l -~ n = over l (subtract n)+{-# INLINE (-~) #-}++ {- | ('<>~') appends a value monoidally to the target.
src/Lens/Micro/Extras.hs view
@@ -3,7 +3,7 @@ {- | Module : Lens.Micro.Extras-Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom+Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom Kazak, 2018 Monadfix License : BSD-style (see the file LICENSE) -} module Lens.Micro.Extras
src/Lens/Micro/Internal.hs view
@@ -15,7 +15,7 @@ {- | Module : Lens.Micro.Internal-Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom+Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom Kazak, 2018 Monadfix License : BSD-style (see the file LICENSE) This module is needed to give other packages from the microlens family (like <http://hackage.haskell.org/package/microlens-ghc microlens-ghc>) access to functions and classes that don't need to be exported from "Lens.Micro" (because they just clutter the namespace). Also:@@ -169,6 +169,9 @@ ( .# ) :: (b -> c) -> (a -> b) -> (a -> c) ( .# ) pbc _ = unsafeCoerce pbc #endif++{-# INLINE ( #. ) #-}+{-# INLINE ( .# ) #-} infixr 9 #. infixl 8 .#
src/Lens/Micro/Type.hs view
@@ -5,7 +5,7 @@ {- | Module : Lens.Micro.Type-Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom+Copyright : (C) 2013-2016 Edward Kmett, 2015-2016 Artyom Kazak, 2018 Monadfix License : BSD-style (see the file LICENSE) This module provides just the types ('Lens', 'Traversal', etc). It's needed to break the dependency cycle – "Lens.Micro" depends on "Lens.Micro.Internal", but "Lens.Micro.Internal" needs types like 'Lens', so 'Lens' can't be defined in "Lens.Micro".