data-diverse 3.0.0.0 → 3.1.0.0
raw patch · 5 files changed
+22/−25 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.Diverse.Which.Internal: instance GHC.Read.Read (Data.Diverse.Which.Internal.Which '[])
- Data.Diverse.Many: grabTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Many xs -> x
+ Data.Diverse.Many: grabTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => Many xs -> x
- Data.Diverse.Many: replaceTag :: forall l x y xs. (UniqueLabelMember l xs, x ~ KindAtLabel l xs) => Many xs -> y -> Many (Replace x (Tagged l y) xs)
+ Data.Diverse.Many: replaceTag :: forall l x y xs. (UniqueMember (Tagged l x) xs) => Many xs -> y -> Many (Replace (Tagged l x) (Tagged l y) xs)
- Data.Diverse.Many: replaceTag' :: forall l xs x. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Many xs -> x -> Many xs
+ Data.Diverse.Many: replaceTag' :: forall l xs x. (UniqueMember (Tagged l x) xs) => Many xs -> x -> Many xs
- Data.Diverse.Many.Internal: grabTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Many xs -> x
+ Data.Diverse.Many.Internal: grabTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => Many xs -> x
- Data.Diverse.Many.Internal: replaceTag :: forall l x y xs. (UniqueLabelMember l xs, x ~ KindAtLabel l xs) => Many xs -> y -> Many (Replace x (Tagged l y) xs)
+ Data.Diverse.Many.Internal: replaceTag :: forall l x y xs. (UniqueMember (Tagged l x) xs) => Many xs -> y -> Many (Replace (Tagged l x) (Tagged l y) xs)
- Data.Diverse.Many.Internal: replaceTag' :: forall l xs x. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Many xs -> x -> Many xs
+ Data.Diverse.Many.Internal: replaceTag' :: forall l xs x. (UniqueMember (Tagged l x) xs) => Many xs -> x -> Many xs
- Data.Diverse.Which: pickTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => x -> Which xs
+ Data.Diverse.Which: pickTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => x -> Which xs
- Data.Diverse.Which: trialTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Which xs -> Either (Which (Remove (Tagged l x) xs)) x
+ Data.Diverse.Which: trialTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => Which xs -> Either (Which (Remove (Tagged l x) xs)) x
- Data.Diverse.Which: trialTag' :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Which xs -> Maybe x
+ Data.Diverse.Which: trialTag' :: forall l x xs. (UniqueMember (Tagged l x) xs) => Which xs -> Maybe x
- Data.Diverse.Which.Internal: pickTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => x -> Which xs
+ Data.Diverse.Which.Internal: pickTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => x -> Which xs
- Data.Diverse.Which.Internal: trialTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Which xs -> Either (Which (Remove (Tagged l x) xs)) x
+ Data.Diverse.Which.Internal: trialTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => Which xs -> Either (Which (Remove (Tagged l x) xs)) x
- Data.Diverse.Which.Internal: trialTag' :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs) => Which xs -> Maybe x
+ Data.Diverse.Which.Internal: trialTag' :: forall l x xs. (UniqueMember (Tagged l x) xs) => Which xs -> Maybe x
Files
- README.md +4/−0
- data-diverse.cabal +1/−2
- src/Data/Diverse/Many/Internal.hs +10/−10
- src/Data/Diverse/Which/Internal.hs +7/−12
- test/Data/Diverse/WhichSpec.hs +0/−1
README.md view
@@ -14,6 +14,10 @@ # Changelog +* 3.1.0.0+ - Removed `Read` instance for `Which []` since it is uninhabitable.+ - `xxxTag` functions only rely on `UniqueMember`, not `UniqueLabelMember`+ * 3.0.0.0 - Renamed `fetch` to `grab` to avoid conflicting with Haxl. - Removed unused type functions from removed splitting functions (Before,To,After,From,Length)
data-diverse.cabal view
@@ -1,5 +1,5 @@ name: data-diverse-version: 3.0.0.0+version: 3.1.0.0 synopsis: Extensible records and polymorphic variants. description: "Data.Diverse.Many" is an extensible record for any size encoded efficiently as (Seq Any). "Data.Diverse.Which" is a polymorphic variant of possibilities encoded as (Int, Any).@@ -69,7 +69,6 @@ build-depends: base , data-diverse , criterion- ghc-options: -O2 default-language: Haskell2010 source-repository head
src/Data/Diverse/Many/Internal.hs view
@@ -437,10 +437,10 @@ -------------------------------------------------- --- | Variation of 'grabL' specialized for 'Tagged' that untags the field.-grabTag :: forall l x xs. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs)+-- | Variation of 'grab' of a Tagged field 'Tagged' that untags the field.+grabTag :: forall l x xs. (UniqueMember (Tagged l x) xs) => Many xs -> x-grabTag xs = unTagged (grabL @l xs)+grabTag xs = unTagged (grab @(Tagged l x) xs) -------------------------------------------------- @@ -507,15 +507,15 @@ -------------------------------------------------- --- | Variation of 'replaceL'' specialized to 'Tagged' that automatically tags the value to be replaced.-replaceTag' :: forall l xs x. (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs)+-- | Variation of 'replace'' specialized to 'Tagged' that automatically tags the value to be replaced.+replaceTag' :: forall l xs x. (UniqueMember (Tagged l x) xs) => Many xs -> x -> Many xs-replaceTag' xs x = replaceL' @l xs (Tagged @l x)+replaceTag' xs x = replace' @(Tagged l x) xs (Tagged @l x) --- | Variation of 'replaceL' specialized to 'Tagged' that automatically tags the value to be replaced.-replaceTag :: forall l x y xs. (UniqueLabelMember l xs, x ~ KindAtLabel l xs)- => Many xs -> y -> Many (Replace x (Tagged l y) xs)-replaceTag xs y = replaceL @l xs (Tagged @l y)+-- | Variation of 'replace' specialized to 'Tagged' that automatically tags the value to be replaced.+replaceTag :: forall l x y xs. (UniqueMember (Tagged l x) xs)+ => Many xs -> y -> Many (Replace (Tagged l x) (Tagged l y) xs)+replaceTag xs y = replace @(Tagged l x) xs (Tagged @l y) --------------------------------------------------
src/Data/Diverse/Which/Internal.hs view
@@ -216,10 +216,10 @@ => x -> Which xs pickL = pick_ @x --- | Variation of 'pickL' specialized to 'Tagged' that automatically tags the value.-pickTag :: forall l x xs . (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs)+-- | Variation of 'pick' specialized to 'Tagged' that automatically tags the value.+pickTag :: forall l x xs . (UniqueMember (Tagged l x) xs) => x -> Which xs-pickTag a = pickL @l (Tagged @l a)+pickTag a = pick @(Tagged l x) (Tagged @l a) -- | A variation of 'pick' into a 'Which' of a single type. --@@ -322,9 +322,9 @@ -- | Variation of 'trialL' specialized to 'Tagged' which untags the field. trialTag :: forall l x xs.- (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs)+ (UniqueMember (Tagged l x) xs) => Which xs -> Either (Which (Remove (Tagged l x) xs)) x-trialTag xs = unTagged <$> trialL @l xs+trialTag xs = unTagged <$> trial @(Tagged l x) xs -- | Variation of 'trialN' which returns a Maybe trialN'@@ -353,9 +353,9 @@ -- | Variation of 'trialL'' specialized to 'Tagged' which untags the field. trialTag' :: forall l x xs.- (UniqueLabelMember l xs, Tagged l x ~ KindAtLabel l xs)+ (UniqueMember (Tagged l x) xs) => Which xs -> Maybe x-trialTag' xs = unTagged <$> trialL' @l xs+trialTag' xs = unTagged <$> trial' @(Tagged l x) xs -- | A variation of a 'Which' 'trial' which 'trial's the first type in the type list. --@@ -872,11 +872,6 @@ pure $ Which n v where app_prec = 10---- | Reading a 'Which '[]' value is always a parse error, considering--- 'Which '[]' as a data type with no constructors.-instance Read (Which '[]) where- readsPrec _ _ = [] ------------------------------------------------------------------ instance NFData (Which '[]) where
test/Data/Diverse/WhichSpec.hs view
@@ -259,7 +259,6 @@ reinterpret' @'[] z `shouldBe` Just z reinterpret @'[] z `shouldBe` Right z diversify @'[] z `shouldBe` z- read (show z) `shouldBe` z compare z z `shouldBe` EQ reinterpret' @'[] x `shouldBe` Nothing reinterpret @'[] x `shouldBe` Left x