microlens-platform 0.4.3.4 → 0.4.3.5
raw patch · 3 files changed
+23/−4 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Lens.Micro.Platform: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Lens.Micro.Internal.At (Data.HashSet.Internal.HashSet k)
+ Lens.Micro.Platform: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Lens.Micro.Internal.Ixed (Data.HashSet.Internal.HashSet k)
Files
- CHANGELOG.md +7/−3
- microlens-platform.cabal +1/−1
- src/Lens/Micro/Platform.hs +15/−0
CHANGELOG.md view
@@ -1,14 +1,18 @@+# 0.4.3.5++* [#131](https://github.com/stevenfontanella/microlens/issues/131) Add `At` and `Ixed` instance for `HashSet`.+ # 0.4.3.4 -* [#171](https://github.com/stevenfontanella/microlens/pull/171) Support text 2.1+* [#171](https://github.com/stevenfontanella/microlens/pull/171) Support text 2.1. # 0.4.3.3 -* [#161](https://github.com/stevenfontanella/microlens/pull/161) Fix GHC 9.4 warning for using `~` without TypeOperators+* [#161](https://github.com/stevenfontanella/microlens/pull/161) Fix GHC 9.4 warning for using `~` without TypeOperators. # 0.4.3.2 -* [#156](https://github.com/stevenfontanella/microlens/pull/156) Add a missing upper bound for text dependency+* [#156](https://github.com/stevenfontanella/microlens/pull/156) Add a missing upper bound for text dependency. # 0.4.3.1
microlens-platform.cabal view
@@ -1,5 +1,5 @@ name: microlens-platform-version: 0.4.3.4+version: 0.4.3.5 synopsis: microlens + all batteries included (best for apps) description: This package exports a module which is the recommended starting point for using <http://hackage.haskell.org/package/microlens microlens> if you aren't trying to keep your dependencies minimal. By importing @Lens.Micro.Platform@ you get all functions and instances from <http://hackage.haskell.org/package/microlens microlens>, <http://hackage.haskell.org/package/microlens-th microlens-th>, <http://hackage.haskell.org/package/microlens-mtl microlens-mtl>, <http://hackage.haskell.org/package/microlens-ghc microlens-ghc>, as well as instances for @Vector@, @Text@, and @HashMap@.
src/Lens/Micro/Platform.hs view
@@ -55,8 +55,10 @@ import Data.Hashable import Data.Int import Data.Monoid+import Data.Functor (($>)) import Data.HashMap.Lazy as HashMap+import Data.HashSet as HashSet import Data.Vector as Vector import Data.Vector.Primitive as Prim import Data.Vector.Storable as Storable@@ -73,6 +75,9 @@ type instance Index (HashMap k a) = k type instance IxValue (HashMap k a) = a+type instance Index (HashSet a) = a+type instance IxValue (HashSet a) = ()+type instance IxValue (HashMap k a) = a type instance Index (Vector.Vector a) = Int type instance IxValue (Vector.Vector a) = a type instance Index (Prim.Vector a) = Int@@ -97,6 +102,16 @@ Nothing -> maybe m (const (HashMap.delete k m)) mv Just v' -> HashMap.insert k v' m where mv = HashMap.lookup k m+ {-# INLINE at #-}++instance (Eq k, Hashable k) => Ixed (HashSet k) where+ ix k f m = if HashSet.member k m+ then f () $> m+ else pure m+ {-# INLINE ix #-}++instance (Eq k, Hashable k) => At (HashSet k) where+ at k f s = HashSet.fromMap <$> HashMap.alterF f k (HashSet.toMap s) {-# INLINE at #-} instance Ixed (Vector.Vector a) where