summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdamGundry <>2020-04-15 21:03:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-04-15 21:03:00 (GMT)
commit7c0b0205c93b1657da16d43065d6cd43873b5ba9 (patch)
treec1bc0605b5cc443797723f59518dcda23c7146da
parent54c198f477b2435a5da3a9e4526c5eaaf68db2a2 (diff)
version 0.30.3
-rw-r--r--CHANGELOG.md8
-rw-r--r--optics-extra.cabal6
-rw-r--r--src/Data/HashMap/Optics.hs2
-rw-r--r--src/Optics/Cons.hs33
-rw-r--r--src/Optics/Indexed.hs1
-rw-r--r--src/Optics/View.hs3
6 files changed, 31 insertions, 22 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1648ca..19c4b43 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/optics-extra.cabal b/optics-extra.cabal
index 07b9506..0527f02 100644
--- a/optics-extra.cabal
+++ b/optics-extra.cabal
@@ -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 @@ library
, 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
diff --git a/src/Data/HashMap/Optics.hs b/src/Data/HashMap/Optics.hs
index 190ef86..6c2cc5d 100644
--- a/src/Data/HashMap/Optics.hs
+++ b/src/Data/HashMap/Optics.hs
@@ -55,7 +55,7 @@ import Optics.Core
-- | 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")]
diff --git a/src/Optics/Cons.hs b/src/Optics/Cons.hs
index 7355ec5..ab60f9c 100644
--- a/src/Optics/Cons.hs
+++ b/src/Optics/Cons.hs
@@ -40,48 +40,49 @@ import qualified Data.Vector.Storable as Storable
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 @@ instance (Unbox a, Unbox b) => Cons (Unbox.Vector a) (Unbox.Vector b) a b where
-- 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 #-}
diff --git a/src/Optics/Indexed.hs b/src/Optics/Indexed.hs
index 61c305a..2734d4f 100644
--- a/src/Optics/Indexed.hs
+++ b/src/Optics/Indexed.hs
@@ -45,6 +45,7 @@ module Optics.Indexed
, FoldableWithIndex (..)
, itraverse_
, ifor_
+ , itoList
-- ** Traversable with index
, TraversableWithIndex (..)
, ifor
diff --git a/src/Optics/View.hs b/src/Optics/View.hs
index d8c80cb..e6f61d7 100644
--- a/src/Optics/View.hs
+++ b/src/Optics/View.hs
@@ -4,6 +4,7 @@ module Optics.View where
import Control.Monad.Reader.Class
import Control.Monad.State
import Control.Monad.Writer
+import Data.Kind
import Optics.Core
@@ -26,7 +27,7 @@ import Optics.Core
-- 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