on master help sign in
Update comment, re: append
commited195a60a4d2201607d9d0bd4fd66a65d621b4df authorSridhar Ratnakumar <srid@srid.ca> dateFri 28 Aug 2020, 16:23 (6 years ago) parentfc0c447
2 files changed+6−3
src/JRec.hs+1−1 test/JRecSpec.hs+5−2
src/JRec.hs+1−1
@@ -45,7 +45,7 @@ unField _ (_ R.:= value) = value
4545--
4646-- O(n + m) type check complexity.
4747--
48−-- FIXME: overwrites all indices (see spec)
48+-- FIXME: See spec for a bug when there are duplicates.
4949append ::
5050 forall lhs rhs res.
5151 ( KnownNat (R.RecSize lhs),
test/JRecSpec.hs+5−2
@@ -50,7 +50,10 @@ spec = do
5050 Rec (#a := 1) `append` Rec (#b := 2)
5151 `shouldBe` Rec (#a := 1, #b := 2)
5252 it "append with duplicates" $ do
53− pendingWith "append is overwriting all duplicate fields with same value"
53+ -- `append` will not deal with duplicates; based on current
54+ -- implementation, the last value (here, 8) will overwrite all duplicate
55+ -- fields. See `union` if you want to deal with duplicates sensibly.
56+ pendingWith "append should just append?"
5457 let r1 = Rec (#b := 5, #a := 6)
5558 r2 = Rec (#c := 7, #a := 8)
5659 r1 `append` r2
@@ -59,7 +62,7 @@ spec = do
5962 it "simple union" $ do
6063 Rec (#a := 1) `union` Rec (#b := 2)
6164 `shouldBe` Rec (#a := 1, #b := 2)
62− it "union with duplicates" $ do
65+ it "union with duplicates (left-biased)" $ do
6366 let r1 = Rec (#b := 5, #a := 6)
6467 r2 = Rec (#c := 7, #a := 8)
6568 r1 `union` r2