microlens-platform 0.2.0.0 → 0.2.1.0
raw patch · 4 files changed
+72/−3 lines, 4 filesdep ~microlensdep ~microlens-ghcPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: microlens, microlens-ghc
API changes (from Hackage documentation)
- Lens.Micro.Platform: instance c ~ d => Lens.Micro.Internal.Each (Data.HashMap.Base.HashMap c a) (Data.HashMap.Base.HashMap d b) a b
+ Lens.Micro.Platform: instance (c ~ d) => Lens.Micro.Internal.Each (Data.HashMap.Base.HashMap c a) (Data.HashMap.Base.HashMap d b) a b
+ Lens.Micro.Platform: instance Lens.Micro.Internal.Strict Data.Text.Internal.Lazy.Text Data.Text.Internal.Text
+ Lens.Micro.Platform: packed :: IsText t => Lens' String t
+ Lens.Micro.Platform: unpacked :: IsText t => Lens' t String
+ Lens.Micro.Platform.Internal: class IsText t
+ Lens.Micro.Platform.Internal: instance Lens.Micro.Platform.Internal.IsText Data.Text.Internal.Lazy.Text
+ Lens.Micro.Platform.Internal: instance Lens.Micro.Platform.Internal.IsText Data.Text.Internal.Text
+ Lens.Micro.Platform.Internal: instance Lens.Micro.Platform.Internal.IsText GHC.Base.String
+ Lens.Micro.Platform.Internal: packed :: IsText t => Lens' String t
+ Lens.Micro.Platform.Internal: unpacked :: IsText t => Lens' t String
Files
- CHANGELOG.md +6/−0
- microlens-platform.cabal +4/−3
- src/Lens/Micro/Platform.hs +10/−0
- src/Lens/Micro/Platform/Internal.hs +52/−0
CHANGELOG.md view
@@ -1,3 +1,9 @@+# 0.2.1.0++* Added `packed` and `unpacked`.+* Added instances for `Strict`.+* New minor release (microlens-0.4.1, microlens-ghc-0.4.1).+ # 0.2.0.0 * New major release (microlens-0.4, microlens-th-0.3, microlens-ghc-0.4).
microlens-platform.cabal view
@@ -1,5 +1,5 @@ name: microlens-platform-version: 0.2.0.0+version: 0.2.1.0 synopsis: Feature-complete microlens 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@.@@ -25,12 +25,13 @@ library exposed-modules: Lens.Micro.Platform+ Lens.Micro.Platform.Internal -- other-modules: -- other-extensions: build-depends: base >=4.5 && <5 , hashable >=1.1.2.3 && <1.3- , microlens ==0.4.0.*- , microlens-ghc ==0.4.0.*+ , microlens ==0.4.1.*+ , microlens-ghc ==0.4.1.* , microlens-mtl ==0.1.6.* , microlens-th ==0.3.0.* , text >=0.11 && <1.3
src/Lens/Micro/Platform.hs view
@@ -29,12 +29,15 @@ * 'Vector.Vector' and variants * strict and lazy @Text@++* 'strict' and 'lazy' for @Text@ -} module Lens.Micro.Platform ( module Lens.Micro.GHC, module Lens.Micro.Mtl, module Lens.Micro.TH,+ packed, unpacked, ) where @@ -43,6 +46,7 @@ import Lens.Micro.GHC import Lens.Micro.Mtl import Lens.Micro.TH+import Lens.Micro.Platform.Internal import Data.Hashable import Data.Int@@ -270,3 +274,9 @@ "vectorTraverse -> mapped" vectorTraverse = sets Generic.map :: (Generic.Vector v a, Generic.Vector v b) => ASetter (v a) (v b) a b; "vectorTraverse -> foldr" vectorTraverse = foldring Generic.foldr :: Generic.Vector v a => Getting (Endo r) (v a) a; #-}++instance Strict TL.Text T.Text where+ strict f s = TL.fromStrict <$> f (TL.toStrict s)+ {-# INLINE strict #-}+ lazy f s = TL.toStrict <$> f (TL.fromStrict s)+ {-# INLINE lazy #-}
+ src/Lens/Micro/Platform/Internal.hs view
@@ -0,0 +1,52 @@+{-# LANGUAGE+CPP,+FlexibleInstances,+Safe+ #-}+++module Lens.Micro.Platform.Internal+(+ IsText(..),+)+where+++import Lens.Micro++import qualified Data.Text as T+import qualified Data.Text.Lazy as TL++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif+++class IsText t where+ {- |+'packed' lets you convert between 'String' and @Text@ (strict or lazy). It can be used as a replacement for @pack@ or as a way to modify some 'String' if you have a function like @Text -> Text@.+ -}+ packed :: Lens' String t++ {- |+'unpacked' is like 'packed' but works in the opposite direction.+ -}+ unpacked :: Lens' t String++instance IsText String where+ packed = id+ {-# INLINE packed #-}+ unpacked = id+ {-# INLINE unpacked #-}++instance IsText T.Text where+ packed f s = T.unpack <$> f (T.pack s)+ {-# INLINE packed #-}+ unpacked f s = T.pack <$> f (T.unpack s)+ {-# INLINE unpacked #-}++instance IsText TL.Text where+ packed f s = TL.unpack <$> f (TL.pack s)+ {-# INLINE packed #-}+ unpacked f s = TL.pack <$> f (TL.unpack s)+ {-# INLINE unpacked #-}