data-diverse 0.1.0.0 → 0.2.0.0
raw patch · 4 files changed
+13/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.Diverse.PackageId: type PackageId = "data-diverse-0.1.0.0-15JNBdcTY3F9aOKAG5iNge"
+ Data.Diverse.PackageId: type PackageId = "data-diverse-0.2.0.0-GlnmSQqNwDC9lfFZmoKMcf"
- Data.Diverse.Which: diversify0 :: proxy x -> Which xs -> Which (x : xs)
+ Data.Diverse.Which: diversify0 :: Which xs -> Which (x : xs)
- Data.Diverse.Which.Internal: diversify0 :: proxy x -> Which xs -> Which (x : xs)
+ Data.Diverse.Which.Internal: diversify0 :: Which xs -> Which (x : xs)
Files
- data-diverse.cabal +3/−3
- src/Data/Diverse/PackageId.hs +1/−1
- src/Data/Diverse/Which/Internal.hs +8/−6
- test/Data/Diverse/WhichSpec.hs +1/−1
data-diverse.cabal view
@@ -1,12 +1,12 @@ name: data-diverse-version: 0.1.0.0+version: 0.2.0.0 synopsis: Extensible records and polymorphic variants. description: "Data.Diverse.Many" is an extensible record for any size encoded efficiently as (Int, Map Int Any).- "Data.Diverse.Which" polymorphic variant of possibilities encoded as (Int, Any).+ "Data.Diverse.Which" is a polymorphic variant of possibilities encoded as (Int, Any). Provides getters, setters, projection, injection, fold, and catamorphisms; accessed by type or index. Refer to [ManySpec.hs](https://github.com/louispan/data-diverse/blob/master/test/Data/Diverse/ManySpec.hs) and [WhichSpec.hs](https://github.com/louispan/data-diverse/blob/master/test/Data/Diverse/WhichSpec.hs) for example usages.-homepage: https://github.com/louispan/data-distinct#readme+homepage: https://github.com/louispan/data-diverse#readme license: BSD3 license-file: LICENSE author: Louis Pan
src/Data/Diverse/PackageId.hs view
@@ -4,4 +4,4 @@ -- | This is used for the Generic D1 metadata. -- NB. package id is obtained by running `stack exec ghc-pkg describe data-diverse`-type PackageId = "data-diverse-0.1.0.0-15JNBdcTY3F9aOKAG5iNge"+type PackageId = "data-diverse-0.2.0.0-GlnmSQqNwDC9lfFZmoKMcf"
src/Data/Diverse/Which/Internal.hs view
@@ -146,7 +146,7 @@ Left v' -> G.R1 ({- G.Rec0 -} G.K1 v') to ({- G.D1 -} G.M1 ({- G.Rec0 -} x)) = case x of G.L1 ({- G.Rec0 -} G.K1 a) -> pick0 a- G.R1 ({- G.Rec0 -} G.K1 v) -> diversify0 Proxy v+ G.R1 ({- G.Rec0 -} G.K1 v) -> diversify0 v ----------------------------------------------------------------------- @@ -316,8 +316,8 @@ case' CaseDiversify = pick -- | A simple version of 'diversify' which add another type to the front of the typelist.-diversify0 :: proxy x -> Which xs -> Which (x ': xs)-diversify0 _ (Which n v) = Which (n + 1) v+diversify0 :: Which xs -> Which (x ': xs)+diversify0 (Which n v) = Which (n + 1) v ------------------------------------------------------------------ @@ -334,9 +334,10 @@ -- the mapping is specified by @indicies@. -- -- @--- let a = 'pick'' (5 :: Int) :: 'Which' '[Int]--- b = 'diversify' \@[Int, Bool] a :: 'Which' '[Int, Bool]--- c = 'diversify' \@[Bool, Int] b :: 'Which' '[Bool, Int]+-- let y = 'pickOnly' (5 :: Int)+-- y' = 'diversifyN' \@'[0] \@[Int, Bool] Proxy y+-- y'' = 'diversifyN' \@[1,0] \@[Bool, Int] Proxy y'+-- 'switch' y'' ('Data.Diverse.CaseTypeable.CaseTypeable' (show . typeRep . (pure \@Proxy))) \`shouldBe` \"Int" -- @ diversifyN :: forall indices tree branch proxy. (DiversifyN indices tree branch) => proxy indices -> Which branch -> Which tree diversifyN _ = whichN (CaseDiversifyN @indices @0 @branch)@@ -433,6 +434,7 @@ -- y \`shouldBe` pick (5 :: Int) :: 'Which' '[Bool, Int, Char, String] -- let y' = 'preview' ('inject' \@[String, Int]) y -- 'reinterpret' -- y' \`shouldBe` Just (pick (5 :: Int)) :: Maybe ('Which' '[String, Int])+-- @ inject :: forall branch tree. ( Diversify tree branch
test/Data/Diverse/WhichSpec.hs view
@@ -132,7 +132,7 @@ y'' = diversify @[Bool, Int] y' switch y'' (CaseTypeable (show . typeRep . (pure @Proxy))) `shouldBe` "Int" - it "can be extended and rearranged by index with 'diversify'" $ do+ it "can be extended and rearranged by index with 'diversifyN'" $ do let y = pickOnly (5 :: Int) y' = diversifyN @'[0] @[Int, Bool] Proxy y y'' = diversifyN @[1,0] @[Bool, Int] Proxy y'