packages feed

microlens-ghc 0.4.11.1 → 0.4.12

raw patch · 3 files changed

+52/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Lens.Micro.GHC: instance GHC.Classes.Ord k => Lens.Micro.Internal.At (Data.Set.Internal.Set k)
+ Lens.Micro.GHC: instance GHC.Classes.Ord k => Lens.Micro.Internal.Ixed (Data.Set.Internal.Set k)
+ Lens.Micro.GHC: instance Lens.Micro.Internal.At Data.IntSet.Internal.IntSet
+ Lens.Micro.GHC: instance Lens.Micro.Internal.Ixed Data.IntSet.Internal.IntSet

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.4.12++* Added `At` and `Ixed` instances for `Set` and `IntSet` (thanks to @wygulmage).+ # 0.4.11.1  * No more conditional `Safe` (see [#122](https://github.com/monadfix/microlens/issues/122)).
microlens-ghc.cabal view
@@ -1,5 +1,5 @@ name:                microlens-ghc-version:             0.4.11.1+version:             0.4.12 synopsis:            microlens + array, bytestring, containers, transformers description:   Use this package instead of <http://hackage.haskell.org/package/microlens microlens> if you don't mind depending on all dependencies here – @Lens.Micro.GHC@ reexports everything from @Lens.Micro@ and additionally provides orphan instances of microlens classes for packages coming with GHC (<http://hackage.haskell.org/package/array array>, <http://hackage.haskell.org/package/bytestring bytestring>, <http://hackage.haskell.org/package/containers containers>, <http://hackage.haskell.org/package/transfromers transformers>).@@ -10,7 +10,7 @@ license:             BSD3 license-file:        LICENSE author:              Edward Kmett, Artyom Kazak-maintainer:          Monadfix <hi@monadfix.io>+maintainer:          Monadfix <hi@monadfix.com> homepage:            http://github.com/monadfix/microlens bug-reports:         http://github.com/monadfix/microlens/issues category:            Data, Lenses@@ -25,7 +25,8 @@                      GHC==8.0.2                      GHC==8.2.2                      GHC==8.4.4-                     GHC==8.6.4+                     GHC==8.6.5+                     GHC==8.8.1  source-repository head   type:                git
src/Lens/Micro/GHC.hs view
@@ -19,11 +19,11 @@  By importing this module you get all functions and types from <http://hackage.haskell.org/package/microlens microlens>, as well as the following instances: -* 'at' for 'Map' and 'IntMap'+* 'at' for 'Map', 'Set', 'IntMap' and 'IntSet'  * 'each' and 'ix' for -    * 'Map' and 'IntMap'+    * 'Map', 'Set', 'IntMap' and 'IntSet'     * 'Array' and 'UArray'     * 'Seq'     * strict 'B.ByteString' and lazy 'BL.ByteString'@@ -59,6 +59,10 @@ import           Data.IntMap (IntMap) import qualified Data.Sequence as Seq import           Data.Sequence (Seq)+import qualified Data.Set as Set+import           Data.Set (Set)+import qualified Data.IntSet as IntSet+import           Data.IntSet (IntSet)  import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL@@ -87,6 +91,10 @@ type instance IxValue (Map k a) = a type instance Index   (IntMap a) = Int type instance IxValue (IntMap a) = a+type instance Index   (Set a) = a+type instance IxValue (Set a) = ()+type instance Index   IntSet = Int+type instance IxValue IntSet = () type instance Index   (Seq a) = Int type instance IxValue (Seq a) = a type instance Index   (Tree a) = [Int]@@ -118,6 +126,18 @@     | otherwise                  = pure m   {-# INLINE ix #-} +instance Ord k => Ixed (Set k) where+  ix k f m = if Set.member k m+     then f () <&> \() -> Set.insert k m+     else pure m+  {-# INLINE ix #-}++instance Ixed IntSet where+  ix k f m = if IntSet.member k m+     then f () <&> \() -> IntSet.insert k m+     else pure m+  {-# INLINE ix #-}+ instance Ixed (Tree a) where   ix xs0 f = go xs0 where     go [] (Node a as) = f a <&> \a' -> Node a' as@@ -154,17 +174,39 @@   {-# INLINE ix #-}  instance At (IntMap a) where+#if MIN_VERSION_containers(0,5,8)+  at k f = IntMap.alterF f k+#else   at k f m = f mv <&> \r -> case r of     Nothing -> maybe m (const (IntMap.delete k m)) mv     Just v' -> IntMap.insert k v' m     where mv = IntMap.lookup k m+#endif   {-# INLINE at #-}  instance Ord k => At (Map k a) where+#if MIN_VERSION_containers(0,5,8)+  at k f = Map.alterF f k+#else   at k f m = f mv <&> \r -> case r of     Nothing -> maybe m (const (Map.delete k m)) mv     Just v' -> Map.insert k v' m     where mv = Map.lookup k m+#endif+  {-# INLINE at #-}++instance At IntSet where+  at k f m = f mv <&> \r -> case r of+    Nothing -> maybe m (const (IntSet.delete k m)) mv+    Just () -> IntSet.insert k m+    where mv = if IntSet.member k m then Just () else Nothing+  {-# INLINE at #-}++instance Ord k => At (Set k) where+  at k f m = f mv <&> \r -> case r of+    Nothing -> maybe m (const (Set.delete k m)) mv+    Just () -> Set.insert k m+    where mv = if Set.member k m then Just () else Nothing   {-# INLINE at #-}  instance (c ~ d) => Each (Map c a) (Map d b) a b where