Verified Commit 19ff7be0 authored by Camil Staps's avatar Camil Staps 🚀

Remove insertR from Data.Set, which is now identical to insert

parent d2a09b20
Pipeline #41193 passed with stage
in 1 minute and 48 seconds
......@@ -82,19 +82,12 @@ singleton x = Bin 1 x Tip Tip
*--------------------------------------------------------------------*/
insert :: !a !.(Set a) -> Set a | < a
insert x t=:(Bin sz y l r)
insert x t=:(Bin _ y l r)
| x < y = balanceL y (insert x l) r
| x > y = balanceR y l (insert x r)
| otherwise = t
insert x _ = singleton x
insertR :: !a !(Set a) -> Set a | < a
insertR x t=:(Bin _ y l r)
| x < y = balanceL y (insertR x l) r
| x > y = balanceR y l (insertR x r)
| otherwise = t
insertR x _ = singleton x
delete :: !a !.(Set a) -> Set a | < a
delete x (Bin _ y l r)
| x < y = balanceR y (delete x l) r
......@@ -143,7 +136,7 @@ deleteMax Tip = Tip
union :: !u:(Set a) !u:(Set a) -> Set a | < a
union t1 Tip = t1
union t1 (Bin _ x Tip Tip) = insertR x t1
union t1 (Bin _ x Tip Tip) = insert x t1
union (Bin _ x Tip Tip) t2 = insert x t2
union Tip t2 = t2
union t1=:(Bin _ x l1 r1) t2 = link x l1l2 r1r2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment