optics-extra 0.2 → 0.3
raw patch · 6 files changed
+31/−22 lines, 6 filesdep ~basedep ~bytestringdep ~hashable
Dependency ranges changed: base, bytestring, hashable, optics-core
Files
- CHANGELOG.md +7/−1
- optics-extra.cabal +3/−3
- src/Data/HashMap/Optics.hs +1/−1
- src/Optics/Cons.hs +17/−16
- src/Optics/Indexed.hs +1/−0
- src/Optics/View.hs +2/−1
CHANGELOG.md view
@@ -1,4 +1,10 @@-# optics-extra-0.1 (2019-10-18)+# optics-extra-0.3 (2020-04-15)+* `optics-core-0.3` compatible release+* GHC-8.10 support+* Use stricter `uncurry'` for better performance++# optics-extra-0.2 (2019-10-18)+* `optics-core-0.2` compatible release * Move `use` from `Optics.View` to `Optics.State` and restrict its type * Add `preuse` to `Optics.State` * Rename `use`, `uses`, `listening` and `listenings` to reflect the fact that
optics-extra.cabal view
@@ -1,12 +1,12 @@ name: optics-extra-version: 0.2+version: 0.3 license: BSD3 license-file: LICENSE build-type: Simple cabal-version: 1.24 maintainer: optics@well-typed.com author: Andrzej Rybczak-tested-with: ghc ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1, GHCJS ==8.4+tested-with: ghc ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.3 || ==8.10.1, GHCJS ==8.4 synopsis: Extra utilities and instances for optics-core category: Data, Optics, Lenses description:@@ -37,7 +37,7 @@ , hashable >= 1.1.1 && <1.4 , indexed-profunctors >= 0.1 && <0.2 , mtl >= 2.2.2 && <2.3- , optics-core >= 0.2 && <0.2.1+ , optics-core >= 0.3 && <0.3.1 , text >= 1.2 && <1.3 , transformers >= 0.5 && <0.6 , unordered-containers >= 0.2.6 && <0.3
src/Data/HashMap/Optics.hs view
@@ -55,7 +55,7 @@ -- | Construct a hash map from an 'IxFold'. -- -- The construction is left-biased (see 'HashMap.union'), i.e. the first--- occurences of keys in the fold or traversal order are preferred.+-- occurrences of keys in the fold or traversal order are preferred. -- -- >>> toMapOf ifolded ["hello", "world"] -- fromList [(0,"hello"),(1,"world")]
src/Optics/Cons.hs view
@@ -40,48 +40,49 @@ import qualified Data.Vector.Unboxed as Unbox import Optics.Core+import Optics.Internal.Utils -- Cons instance Cons StrictB.ByteString StrictB.ByteString Word8 Word8 where- _Cons = prism' (uncurry StrictB.cons) StrictB.uncons+ _Cons = prism' (uncurry' StrictB.cons) StrictB.uncons {-# INLINE _Cons #-} instance Cons LazyB.ByteString LazyB.ByteString Word8 Word8 where- _Cons = prism' (uncurry LazyB.cons) LazyB.uncons+ _Cons = prism' (uncurry' LazyB.cons) LazyB.uncons {-# INLINE _Cons #-} instance Cons StrictT.Text StrictT.Text Char Char where- _Cons = prism' (uncurry StrictT.cons) StrictT.uncons+ _Cons = prism' (uncurry' StrictT.cons) StrictT.uncons {-# INLINE _Cons #-} instance Cons LazyT.Text LazyT.Text Char Char where- _Cons = prism' (uncurry LazyT.cons) LazyT.uncons+ _Cons = prism' (uncurry' LazyT.cons) LazyT.uncons {-# INLINE _Cons #-} instance Cons (Vector a) (Vector b) a b where- _Cons = prism (uncurry Vector.cons) $ \v ->+ _Cons = prism (uncurry' Vector.cons) $ \v -> if Vector.null v then Left Vector.empty else Right (Vector.unsafeHead v, Vector.unsafeTail v) {-# INLINE _Cons #-} instance (Prim a, Prim b) => Cons (Prim.Vector a) (Prim.Vector b) a b where- _Cons = prism (uncurry Prim.cons) $ \v ->+ _Cons = prism (uncurry' Prim.cons) $ \v -> if Prim.null v then Left Prim.empty else Right (Prim.unsafeHead v, Prim.unsafeTail v) {-# INLINE _Cons #-} instance (Storable a, Storable b) => Cons (Storable.Vector a) (Storable.Vector b) a b where- _Cons = prism (uncurry Storable.cons) $ \v ->+ _Cons = prism (uncurry' Storable.cons) $ \v -> if Storable.null v then Left Storable.empty else Right (Storable.unsafeHead v, Storable.unsafeTail v) {-# INLINE _Cons #-} instance (Unbox a, Unbox b) => Cons (Unbox.Vector a) (Unbox.Vector b) a b where- _Cons = prism (uncurry Unbox.cons) $ \v ->+ _Cons = prism (uncurry' Unbox.cons) $ \v -> if Unbox.null v then Left Unbox.empty else Right (Unbox.unsafeHead v, Unbox.unsafeTail v)@@ -90,49 +91,49 @@ -- Snoc instance Snoc (Vector a) (Vector b) a b where- _Snoc = prism (uncurry Vector.snoc) $ \v -> if Vector.null v+ _Snoc = prism (uncurry' Vector.snoc) $ \v -> if Vector.null v then Left Vector.empty else Right (Vector.unsafeInit v, Vector.unsafeLast v) {-# INLINE _Snoc #-} instance (Prim a, Prim b) => Snoc (Prim.Vector a) (Prim.Vector b) a b where- _Snoc = prism (uncurry Prim.snoc) $ \v -> if Prim.null v+ _Snoc = prism (uncurry' Prim.snoc) $ \v -> if Prim.null v then Left Prim.empty else Right (Prim.unsafeInit v, Prim.unsafeLast v) {-# INLINE _Snoc #-} instance (Storable a, Storable b) => Snoc (Storable.Vector a) (Storable.Vector b) a b where- _Snoc = prism (uncurry Storable.snoc) $ \v -> if Storable.null v+ _Snoc = prism (uncurry' Storable.snoc) $ \v -> if Storable.null v then Left Storable.empty else Right (Storable.unsafeInit v, Storable.unsafeLast v) {-# INLINE _Snoc #-} instance (Unbox a, Unbox b) => Snoc (Unbox.Vector a) (Unbox.Vector b) a b where- _Snoc = prism (uncurry Unbox.snoc) $ \v -> if Unbox.null v+ _Snoc = prism (uncurry' Unbox.snoc) $ \v -> if Unbox.null v then Left Unbox.empty else Right (Unbox.unsafeInit v, Unbox.unsafeLast v) {-# INLINE _Snoc #-} instance Snoc StrictB.ByteString StrictB.ByteString Word8 Word8 where- _Snoc = prism (uncurry StrictB.snoc) $ \v -> if StrictB.null v+ _Snoc = prism (uncurry' StrictB.snoc) $ \v -> if StrictB.null v then Left StrictB.empty else Right (StrictB.init v, StrictB.last v) {-# INLINE _Snoc #-} instance Snoc LazyB.ByteString LazyB.ByteString Word8 Word8 where- _Snoc = prism (uncurry LazyB.snoc) $ \v -> if LazyB.null v+ _Snoc = prism (uncurry' LazyB.snoc) $ \v -> if LazyB.null v then Left LazyB.empty else Right (LazyB.init v, LazyB.last v) {-# INLINE _Snoc #-} instance Snoc StrictT.Text StrictT.Text Char Char where- _Snoc = prism (uncurry StrictT.snoc) $ \v -> if StrictT.null v+ _Snoc = prism (uncurry' StrictT.snoc) $ \v -> if StrictT.null v then Left StrictT.empty else Right (StrictT.init v, StrictT.last v) {-# INLINE _Snoc #-} instance Snoc LazyT.Text LazyT.Text Char Char where- _Snoc = prism (uncurry LazyT.snoc) $ \v -> if LazyT.null v+ _Snoc = prism (uncurry' LazyT.snoc) $ \v -> if LazyT.null v then Left LazyT.empty else Right (LazyT.init v, LazyT.last v) {-# INLINE _Snoc #-}
src/Optics/Indexed.hs view
@@ -45,6 +45,7 @@ , FoldableWithIndex (..) , itraverse_ , ifor_+ , itoList -- ** Traversable with index , TraversableWithIndex (..) , ifor
src/Optics/View.hs view
@@ -4,6 +4,7 @@ import Control.Monad.Reader.Class import Control.Monad.State import Control.Monad.Writer+import Data.Kind import Optics.Core @@ -26,7 +27,7 @@ -- mostly useful for things such as 'Optics.Passthrough.passthrough'. -- class ViewableOptic k r where- type ViewResult k r :: *+ type ViewResult k r :: Type gview :: MonadReader s m => Optic' k is s r