Closed paf31 closed 7 years ago
I tried these tests to demonstrate my point that insert
should have a rowlacks constraint:
-- if you insert after deleting what you insert, all is fine
assert' "insert, delete, insert" $
get x (insert x 42 (delete x (insert x 0 {}))) == 42
-- shouldn't be able to insert twice, but it succeeds
assert' "insert, insert" $
get x (insert x 42 (insert x 0 {})) == 42
-- can't delete after inserting twice due to rowlacks failing
assert' "insert, insert, delete" $
get x (insert x 42 (delete x (insert x 0 (insert x 0 {})))) == 42
With the following error for the "insert, insert, delete" case:
[1/1 NoInstanceFound] test/Main.purs:30:25
30 get x (insert x 42 (delete x (insert x 0 (insert x 0 {})))) == 42
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No type class instance was found for
Type.Row.RowLacking Entry "x" Int ( x :: Int )
Thanks everyone, I'll tag an initial release.
If this looks good, I'll tag an initial release and add this library to Bower/Pursuit.