packages feed

microlens-ghc 0.1.0.1 → 0.2.0.0

raw patch · 3 files changed

+50/−4 lines, 3 filesdep ~microlensPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: microlens

API changes (from Hackage documentation)

+ Lens.Micro.GHC: instance Cons (Seq a) (Seq b) a b
+ Lens.Micro.GHC: instance Cons ByteString ByteString Word8 Word8
+ Lens.Micro.GHC: instance Snoc (Seq a) (Seq b) a b
+ Lens.Micro.GHC: instance Snoc ByteString ByteString Word8 Word8

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.2.0.0++* Added instances for `Cons` and `Snoc`.+ # 0.1.0.1  * Bumped microlens version.
microlens-ghc.cabal view
@@ -1,8 +1,10 @@ name:                microlens-ghc-version:             0.1.0.1+version:             0.2.0.0 synopsis:            Orphan instances of microlens classes for packages coming with GHC (array, bytestring, containers) description:   Orphan instances of <http://hackage.haskell.org/package/microlens 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>).+  .+  This package is a part of the <http://hackage.haskell.org/package/microlens microlens> family; see the readme <https://github.com/aelve/microlens#readme on Github>. license:             BSD3 license-file:        LICENSE author:              Artyom@@ -24,7 +26,7 @@   -- other-modules:          -- other-extensions:       build-depends:       base >=4.5 && <5-                     , microlens >=0.1.5 && <0.3+                     , microlens >=0.3 && <0.4                      , array >=0.3.0.2 && <0.6                      , bytestring >=0.9.1.10 && <0.11                      , containers >=0.4.0 && <0.6
src/Lens/Micro/GHC.hs view
@@ -24,9 +24,14 @@      * 'Map' and 'IntMap'     * 'Array' and 'UArray'-    * strict 'B.ByteString' and lazy 'BL.ByteString'     * 'Seq'+    * strict 'B.ByteString' and lazy 'BL.ByteString'     * 'Tree'++* '_head', '_tail', '_init', '_last' for++    * 'Seq'+    * strict and lazy bytestrings -} module Lens.Micro.GHC (@@ -35,7 +40,6 @@   import Lens.Micro-import Lens.Micro.Classes import Lens.Micro.Internal  import qualified Data.Map as Map@@ -193,6 +197,42 @@ instance (a ~ Word8, b ~ Word8) => Each BL.ByteString BL.ByteString a b where   each = traversedLazy   {-# INLINE each #-}++instance Cons (Seq a) (Seq b) a b where+  _Cons f s = case Seq.viewl s of+    x Seq.:< xs -> uncurry (Seq.<|) <$> f (x, xs)+    Seq.EmptyL  -> pure Seq.empty+  {-# INLINE _Cons #-}++instance Snoc (Seq a) (Seq b) a b where+  _Snoc f s = case Seq.viewr s of+    xs Seq.:> x -> uncurry (Seq.|>) <$> f (xs, x)+    Seq.EmptyR  -> pure Seq.empty+  {-# INLINE _Snoc #-}++instance Cons B.ByteString B.ByteString Word8 Word8 where+  _Cons f s = case B.uncons s of+    Just x  -> uncurry B.cons <$> f x+    Nothing -> pure B.empty+  {-# INLINE _Cons #-}++instance Cons BL.ByteString BL.ByteString Word8 Word8 where+  _Cons f s = case BL.uncons s of+    Just x  -> uncurry BL.cons <$> f x+    Nothing -> pure BL.empty+  {-# INLINE _Cons #-}++instance Snoc B.ByteString B.ByteString Word8 Word8 where+  _Snoc f s = if B.null s+    then pure B.empty+    else uncurry B.snoc <$> f (B.init s, B.last s)+  {-# INLINE _Snoc #-}++instance Snoc BL.ByteString BL.ByteString Word8 Word8 where+  _Snoc f s = if BL.null s+    then pure BL.empty+    else uncurry BL.snoc <$> f (BL.init s, BL.last s)+  {-# INLINE _Snoc #-}  ------------------------------------------------------------------------------ -- Control.Lens.Internal.ByteString