packages feed

data-diverse-lens 2.0.0.1 → 2.1.0.0

raw patch · 4 files changed

+66/−52 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.Diverse.Profunctor.Which: type AlsoChoose w a2 b1 b2 b3 = (Category w, Injected w a2 b1 b2 b3)
- Data.Diverse.Profunctor.Many: (*&&*) :: forall w a1 a2 a3 b1 b2 b3. (SelectWith w a1 a2 a3 b1 b2 b3) => w (Many a1) (Many b1) -> w (Many a2) (Many b2) -> w (Many a3) (Many b3)
+ Data.Diverse.Profunctor.Many: (*&&*) :: forall w a1 a2 a3 b1 b2 b3. (Category w, Profunctor w, Strong w, SelectWith a1 a2 a3 b1 b2 b3) => w (Many a1) (Many b1) -> w (Many a2) (Many b2) -> w (Many a3) (Many b3)
- Data.Diverse.Profunctor.Many: (<&&<) :: (ThenSelect w a2 b1 b2 b3) => w (Many a2) (Many b2) -> w a (Many b1) -> w a (Many b3)
+ Data.Diverse.Profunctor.Many: (<&&<) :: (Category w, Profunctor w, Strong w, ThenSelect a2 b1 b2 b3) => w (Many a2) (Many b2) -> w a (Many b1) -> w a (Many b3)
- Data.Diverse.Profunctor.Many: (>&&>) :: forall w a a2 b1 b2 b3. (ThenSelect w a2 b1 b2 b3) => w a (Many b1) -> w (Many a2) (Many b2) -> w a (Many b3)
+ Data.Diverse.Profunctor.Many: (>&&>) :: forall w a a2 b1 b2 b3. (Category w, Profunctor w, Strong w, ThenSelect a2 b1 b2 b3) => w a (Many b1) -> w (Many a2) (Many b2) -> w a (Many b3)
- Data.Diverse.Profunctor.Many: itemized :: forall w a b s t. (Itemized w a b s t) => w a b -> w s t
+ Data.Diverse.Profunctor.Many: itemized :: forall w a b s t. (Profunctor w, Strong w, Itemized a b s t) => w a b -> w s t
- Data.Diverse.Profunctor.Many: projected :: forall proxy w a1 a2 b1 b2. (Projected w a1 a2 b1 b2) => proxy a2 -> w (Many a1) (Many b1) -> w (Many a2) (Many b2)
+ Data.Diverse.Profunctor.Many: projected :: forall proxy w a1 a2 b1 b2. (Profunctor w, Strong w, Projected a1 a2 b1 b2) => proxy a2 -> w (Many a1) (Many b1) -> w (Many a2) (Many b2)
- Data.Diverse.Profunctor.Many: type Itemized w a b s t = (Profunctor w, Strong w, HasItem a b s t, HasItem' a s)
+ Data.Diverse.Profunctor.Many: type Itemized a b s t = (HasItem a b s t, HasItem' a s)
- Data.Diverse.Profunctor.Many: type Projected w a1 a2 b1 b2 = (Profunctor w, Strong w, Select a1 a2, Amend a1 b1 a2, b2 ~ Replaces a1 b1 a2)
+ Data.Diverse.Profunctor.Many: type Projected a1 a2 b1 b2 = (Select a1 a2, Amend a1 b1 a2, b2 ~ Replaces a1 b1 a2)
- Data.Diverse.Profunctor.Many: type SelectWith w a1 a2 a3 b1 b2 b3 = (Category w, Profunctor w, Strong w, Select a1 (AppendUnique a1 a2), Select a2 (AppendUnique a1 a2), a3 ~ AppendUnique a1 a2, b3 ~ Append b1 b2)
+ Data.Diverse.Profunctor.Many: type SelectWith a1 a2 a3 b1 b2 b3 = (Select a1 (AppendUnique a1 a2), Select a2 (AppendUnique a1 a2), a3 ~ AppendUnique a1 a2, b3 ~ Append b1 b2)
- Data.Diverse.Profunctor.Many: type ThenSelect w a2 b1 b2 b3 = (Category w, Profunctor w, Strong w, Select (Complement b1 a2) b1, Select a2 b1, b3 ~ Append (Complement b1 a2) b2)
+ Data.Diverse.Profunctor.Many: type ThenSelect a2 b1 b2 b3 = (Select (Complement b1 a2) b1, Select a2 b1, b3 ~ Append (Complement b1 a2) b2)
- Data.Diverse.Profunctor.Which: (+||+) :: forall w a1 a2 a3 b1 b2 b3. (ChooseBetween w a1 a2 a3 b1 b2 b3) => w (Which a1) (Which b1) -> w (Which a2) (Which b2) -> w (Which a3) (Which b3)
+ Data.Diverse.Profunctor.Which: (+||+) :: forall w a1 a2 a3 b1 b2 b3. (Category w, Profunctor w, Choice w, ChooseBetween a1 a2 a3 b1 b2 b3) => w (Which a1) (Which b1) -> w (Which a2) (Which b2) -> w (Which a3) (Which b3)
- Data.Diverse.Profunctor.Which: (<||<) :: forall w a a2 b1 b2 b3. (AlsoChoose w a2 b1 b2 b3) => w (Which a2) (Which b2) -> w a (Which b1) -> w a (Which b3)
+ Data.Diverse.Profunctor.Which: (<||<) :: forall w a a2 b1 b2 b3. (Category w, Choice w, Injected a2 b1 b2 b3) => w (Which a2) (Which b2) -> w a (Which b1) -> w a (Which b3)
- Data.Diverse.Profunctor.Which: (>||>) :: forall w a a2 b1 b2 b3. (AlsoChoose w a2 b1 b2 b3) => w a (Which b1) -> w (Which a2) (Which b2) -> w a (Which b3)
+ Data.Diverse.Profunctor.Which: (>||>) :: forall w a a2 b1 b2 b3. (Category w, Choice w, Injected a2 b1 b2 b3) => w a (Which b1) -> w (Which a2) (Which b2) -> w a (Which b3)
- Data.Diverse.Profunctor.Which: faceted :: forall w a as x b bs y. Faceted w a as x b bs y => w a b -> w x y
+ Data.Diverse.Profunctor.Which: faceted :: forall w a as x b bs y. (Profunctor w, Choice w, Faceted a as x b bs y) => w a b -> w x y
- Data.Diverse.Profunctor.Which: injected :: (Injected w a a' b b') => w (Which a) (Which b) -> w (Which a') (Which b')
+ Data.Diverse.Profunctor.Which: injected :: (Profunctor w, Choice w, Injected a a' b b') => w (Which a) (Which b) -> w (Which a') (Which b')
- Data.Diverse.Profunctor.Which: type ChooseBetween w a1 a2 a3 b1 b2 b3 = (Category w, Profunctor w, Choice w, Reinterpret a2 (Append a1 a2), a1 ~ Complement (Append a1 a2) a2, a3 ~ Append a1 a2, Diversify b1 (AppendUnique b1 b2), Diversify b2 (AppendUnique b1 b2), b3 ~ AppendUnique b1 b2)
+ Data.Diverse.Profunctor.Which: type ChooseBetween a1 a2 a3 b1 b2 b3 = (Reinterpret a2 (Append a1 a2), a1 ~ Complement (Append a1 a2) a2, a3 ~ Append a1 a2, Diversify b1 (AppendUnique b1 b2), Diversify b2 (AppendUnique b1 b2), b3 ~ AppendUnique b1 b2)
- Data.Diverse.Profunctor.Which: type Faceted w a as x b bs y = (Profunctor w, Choice w, MatchingFacet a x y, AsFacet b y)
+ Data.Diverse.Profunctor.Which: type Faceted a as x b bs y = (MatchingFacet a x y, AsFacet b y)
- Data.Diverse.Profunctor.Which: type Injected w a a' b b' = (Profunctor w, Choice w, Reinterpret a a', Diversify b (AppendUnique (Complement a' a) b), Diversify (Complement a' a) (AppendUnique (Complement a' a) b), b' ~ AppendUnique (Complement a' a) b, Complement a a' ~ '[])
+ Data.Diverse.Profunctor.Which: type Injected a a' b b' = (Reinterpret a a', Diversify b (AppendUnique (Complement a' a) b), Diversify (Complement a' a) (AppendUnique (Complement a' a) b), b' ~ AppendUnique (Complement a' a) b, Complement a a' ~ '[])

Files

README.md view
@@ -8,6 +8,9 @@  # Changelog +* 2.1.0.0+  - Removed profunctor variable @w@ from the constraint synonyms for Projected/Injected.+ * 2.0.0.1   - Forgot to expose constraint synonyms for Projected/Injected. 
data-diverse-lens.cabal view
@@ -1,5 +1,5 @@ name:                data-diverse-lens-version:             2.0.0.1+version:             2.1.0.0 synopsis:            Isos & Lens for Data.Diverse.Many and Prisms for Data.Diverse.Which description:         Isos & Lens for Data.Diverse.Many and Prisms for Data.Diverse.Which                      Refer to [ManySpec.hs](https://github.com/louispan/data-diverse-lens/blob/master/test/Data/Diverse/Lens/ManySpec.hs) and [WhichSpec.hs](https://github.com/louispan/data-diverse-lens/blob/master/test/Data/Diverse/Lens/WhichSpec.hs) for example usages.
src/Data/Diverse/Profunctor/Many.hs view
@@ -31,16 +31,18 @@ import Data.Profunctor  -- | A friendlier constraint synonym for 'itemized'.-type Itemized w a b s t =-    ( Profunctor w-    , Strong w-    , HasItem a b s t+type Itemized a b s t =+    ( HasItem a b s t     , HasItem' a s     )  -- | Like 'Strong' or 'Arrow' but lifting into 'Many'-itemized-    :: forall w a b s t. (Itemized w a b s t)+itemized ::+    forall w a b s t.+    ( Profunctor w+    , Strong w+    , Itemized a b s t+    )     => w a b -> w s t itemized w = dimap (\c -> (view item' c, c)) (\(b, c) -> set (item @a) b c) (first' w) @@ -49,26 +51,24 @@ itemized' w = dimap fetch single w  -- | A friendlier constraint synonym for 'projected'.-type Projected w a1 a2 b1 b2 =-    ( Profunctor w-    , Strong w-    , Select a1 a2+type Projected a1 a2 b1 b2 =+    ( Select a1 a2     , Amend a1 b1 a2     , b2 ~ Replaces a1 b1 a2     )  -- | Like 'Strong' or 'Arrow' but lifting from a 'Many' to a 'Many' of another type-projected-    :: forall proxy w a1 a2 b1 b2. (Projected w a1 a2 b1 b2)+projected :: forall proxy w a1 a2 b1 b2.+    ( Profunctor w+    , Strong w+    , Projected a1 a2 b1 b2+    )     => proxy a2 -> w (Many a1) (Many b1) -> w (Many a2) (Many b2) projected _ w = dimap (\c -> (select c, c)) (\(b, c) -> amend @a1 c b) (first' w)  -- | A friendlier constraint synonym for '*&&*'.-type SelectWith w a1 a2 a3 b1 b2 b3 =-    ( C.Category w-    , Profunctor w-    , Strong w-    , Select a1 (AppendUnique a1 a2)+type SelectWith a1 a2 a3 b1 b2 b3 =+    ( Select a1 (AppendUnique a1 a2)     , Select a2 (AppendUnique a1 a2)     , a3 ~ AppendUnique a1 a2     , b3 ~ Append b1 b2@@ -80,7 +80,12 @@ -- Analogous to a 'Many' combination of both of 'Control.Arrow.***' and 'Control.Arrow.&&&'. -- It is a compile error if the types are not distinct in each of the argument arrow inputs. (*&&*)-    :: forall w a1 a2 a3 b1 b2 b3. (SelectWith w a1 a2 a3 b1 b2 b3)+    :: forall w a1 a2 a3 b1 b2 b3.+    ( C.Category w+    , Profunctor w+    , Strong w+    , SelectWith a1 a2 a3 b1 b2 b3+    )     => w (Many a1) (Many b1)     -> w (Many a2) (Many b2)     -> w (Many a3) (Many b3)@@ -88,11 +93,8 @@ infixr 3 *&&* -- like ***  -- | A friendlier constraint synonym for '>&&>'.-type ThenSelect w a2 b1 b2 b3 =-    ( C.Category w-    , Profunctor w-    , Strong w-    , Select (Complement b1 a2) b1+type ThenSelect a2 b1 b2 b3 =+    ( Select (Complement b1 a2) b1     , Select a2 b1     , b3 ~ Append (Complement b1 a2) b2     )@@ -103,7 +105,11 @@ -- or if the input of the second arrow is not a subset of the output of the first arrow. (>&&>)     :: forall w a a2 b1 b2 b3.-       (ThenSelect w a2 b1 b2 b3)+    ( C.Category w+    , Profunctor w+    , Strong w+    , ThenSelect a2 b1 b2 b3+    )     => w a (Many b1)     -> w (Many a2) (Many b2)     -> w a (Many b3)@@ -112,7 +118,11 @@  -- | right-to-left version of '(>&&>)' (<&&<) ::-       (ThenSelect w a2 b1 b2 b3)+    ( C.Category w+    , Profunctor w+    , Strong w+    , ThenSelect a2 b1 b2 b3+    )     => w (Many a2) (Many b2)     -> w a (Many b1)     -> w a (Many b3)
src/Data/Diverse/Profunctor/Which.hs view
@@ -17,7 +17,6 @@     , injected     , ChooseBetween     , (+||+)-    , AlsoChoose     , (>||>)     , (<||<)     ) where@@ -29,16 +28,18 @@ import Data.Diverse.Lens  -- | A friendlier constraint synonym for 'faceted'.-type Faceted w a as x b bs y =-    ( Profunctor w-    , Choice w-    , MatchingFacet a x y+type Faceted a as x b bs y =+    ( MatchingFacet a x y     , AsFacet b y     )  -- | Like 'Choice' or 'ArrowChoice' but lifting into a polymorphic variant. faceted :: forall w a as x b bs y.-    Faceted w a as x b bs y => w a b -> w x y+    (Profunctor w+    , Choice w+    , Faceted a as x b bs y+    )+    => w a b -> w x y faceted w = dimap (matchingFacet @a @x @y)                    (either id (review facet))                    (right' w)@@ -48,10 +49,8 @@ faceted' w = dimap obvious pickOnly w  -- | A friendlier constraint synonym for 'injected'.-type Injected w a a' b b' =-    ( Profunctor w-    , Choice w-    , Reinterpret a a'+type Injected a a' b b' =+    ( Reinterpret a a'     , Diversify b (AppendUnique (Complement a' a) b)     , Diversify (Complement a' a) (AppendUnique (Complement a' a) b)     , b' ~ AppendUnique (Complement a' a) b@@ -63,18 +62,18 @@ -- NB. It is a compile error if all of the input types in the second arrow @a@ -- is not the output types of the first arrow. -- This prevents surprising behaviour where the second arrow is ignored.-injected-    :: (Injected w a a' b b')+injected ::+    ( Profunctor w+    , Choice w+    , Injected a a' b b'+    )     => w (Which a) (Which b)     -> w (Which a') (Which b') injected w = dimap reinterpret (either diversify diversify) (right' w)  -- | A friendlier constraint synonym for '+||+'.-type ChooseBetween w a1 a2 a3 b1 b2 b3 =-    ( C.Category w-    , Profunctor w-    , Choice w-    , Reinterpret a2 (Append a1 a2)+type ChooseBetween a1 a2 a3 b1 b2 b3 =+    ( Reinterpret a2 (Append a1 a2)     , a1 ~ Complement (Append a1 a2) a2     , a3 ~ Append a1 a2     , Diversify b1 (AppendUnique b1 b2)@@ -91,7 +90,11 @@ -- @UniqueMember@ constraints in 'Reinterpret'. (+||+)     :: forall w a1 a2 a3 b1 b2 b3.-       (ChooseBetween w a1 a2 a3 b1 b2 b3)+       ( C.Category w+       , Profunctor w+       , Choice w+       , ChooseBetween a1 a2 a3 b1 b2 b3+       )     => w (Which a1) (Which b1)     -> w (Which a2) (Which b2)     -> w (Which a3) (Which b3)@@ -101,12 +104,6 @@         (lmap (reinterpret @a2 @(Append a1 a2)) (left' x) C.>>> right' y) infixr 2 +||+ -- like +++ --- | A friendlier constraint synonym for '>||>'.-type AlsoChoose w a2 b1 b2 b3 =-    ( C.Category w-    , Injected w a2 b1 b2 b3-    )- -- | Left-to-right chaining of arrows one after another,  where left over possibilities not handled -- by the right arrow is forwarded to the output. -- It is a compile error if the types are not distinct in each of the argument arrow inputs,@@ -116,7 +113,9 @@ -- The compile error will be due to the @Complement c b ~ '[]@ constraint. (>||>)     :: forall w a a2 b1 b2 b3.-       ( AlsoChoose w a2 b1 b2 b3+       ( C.Category w+       , Choice w+       , Injected a2 b1 b2 b3        )     => w a (Which b1)     -> w (Which a2) (Which b2)@@ -127,7 +126,9 @@ -- | right-to-left version of '(>||>)' (<||<)     :: forall w a a2 b1 b2 b3.-       ( AlsoChoose w a2 b1 b2 b3+       ( C.Category w+       , Choice w+       , Injected a2 b1 b2 b3        )     => w (Which a2) (Which b2)     -> w a (Which b1)