@@ -106,7 +106,7 @@ singleton k v = Two Leaf k v Leaf
106106checkValid :: forall k v . Map k v -> Boolean
107107checkValid tree = length (nub (allHeights tree)) == one
108108 where
109- allHeights :: forall k v . Map k v -> List Int
109+ allHeights :: Map k v -> List Int
110110 allHeights Leaf = pure zero
111111 allHeights (Two left _ _ right) = map (\n -> n + one) (allHeights left ++ allHeights right)
112112 allHeights (Three left _ _ mid _ _ right) = map (\n -> n + one) (allHeights left ++ allHeights mid ++ allHeights right)
@@ -148,7 +148,7 @@ data KickUp k v = KickUp (Map k v) k v (Map k v)
148148insert :: forall k v . (Ord k ) => k -> v -> Map k v -> Map k v
149149insert = down Nil
150150 where
151- down :: forall k v . ( Ord k ) => List (TreeContext k v ) -> k -> v -> Map k v -> Map k v
151+ down :: List (TreeContext k v ) -> k -> v -> Map k v -> Map k v
152152 down ctx k v Leaf = up ctx (KickUp Leaf k v Leaf )
153153 down ctx k v (Two left k1 _ right) | k == k1 = fromZipper ctx (Two left k v right)
154154 down ctx k v (Two left k1 v1 right) | k < k1 = down (Cons (TwoLeft k1 v1 right) ctx) k v left
@@ -159,7 +159,7 @@ insert = down Nil
159159 down ctx k v (Three left k1 v1 mid k2 v2 right) | k1 < k && k <= k2 = down (Cons (ThreeMiddle left k1 v1 k2 v2 right) ctx) k v mid
160160 down ctx k v (Three left k1 v1 mid k2 v2 right) = down (Cons (ThreeRight left k1 v1 mid k2 v2) ctx) k v right
161161
162- up :: forall k v . ( Ord k ) => List (TreeContext k v ) -> KickUp k v -> Map k v
162+ up :: List (TreeContext k v ) -> KickUp k v -> Map k v
163163 up Nil (KickUp left k v right) = Two left k v right
164164 up (Cons (TwoLeft k1 v1 right) ctx) (KickUp left k v mid) = fromZipper ctx (Three left k v mid k1 v1 right)
165165 up (Cons (TwoRight left k1 v1) ctx) (KickUp mid k v right) = fromZipper ctx (Three left k1 v1 mid k v right)
@@ -171,7 +171,7 @@ insert = down Nil
171171delete :: forall k v . (Ord k ) => k -> Map k v -> Map k v
172172delete = down Nil
173173 where
174- down :: forall k v . ( Ord k ) => List (TreeContext k v ) -> k -> Map k v -> Map k v
174+ down :: List (TreeContext k v ) -> k -> Map k v -> Map k v
175175 down ctx _ Leaf = fromZipper ctx Leaf
176176 down ctx k (Two Leaf k1 _ Leaf )
177177 | k == k1 = up ctx Leaf
@@ -192,7 +192,7 @@ delete = down Nil
192192 | k1 < k && k < k2 = down (Cons (ThreeMiddle left k1 v1 k2 v2 right) ctx) k mid
193193 | otherwise = down (Cons (ThreeRight left k1 v1 mid k2 v2) ctx) k right
194194
195- up :: forall k v . ( Ord k ) => List (TreeContext k v ) -> Map k v -> Map k v
195+ up :: List (TreeContext k v ) -> Map k v -> Map k v
196196 up Nil tree = tree
197197 up (Cons (TwoLeft k1 v1 Leaf ) ctx) Leaf = fromZipper ctx (Two Leaf k1 v1 Leaf )
198198 up (Cons (TwoRight Leaf k1 v1) ctx) Leaf = fromZipper ctx (Two Leaf k1 v1 Leaf )
@@ -213,15 +213,15 @@ delete = down Nil
213213 up (Cons (ThreeRight a k1 v1 (Three b k2 v2 c k3 v3 d) k4 v4) ctx) e = fromZipper ctx (Three a k1 v1 (Two b k2 v2 c) k3 v3 (Two d k4 v4 e))
214214 up _ _ = unsafeThrow " Impossible case in 'up'"
215215
216- maxNode :: forall k v . ( Ord k ) => Map k v -> { key :: k , value :: v }
216+ maxNode :: Map k v -> { key :: k , value :: v }
217217 maxNode (Two _ k v Leaf ) = { key: k, value: v }
218218 maxNode (Two _ _ _ right) = maxNode right
219219 maxNode (Three _ _ _ _ k v Leaf ) = { key: k, value: v }
220220 maxNode (Three _ _ _ _ _ _ right) = maxNode right
221221 maxNode Leaf = unsafeThrow " Impossible case in 'maxNode'"
222222
223223
224- removeMaxNode :: forall k v . ( Ord k ) => List (TreeContext k v ) -> Map k v -> Map k v
224+ removeMaxNode :: List (TreeContext k v ) -> Map k v -> Map k v
225225 removeMaxNode ctx (Two Leaf _ _ Leaf ) = up ctx Leaf
226226 removeMaxNode ctx (Two left k v right) = removeMaxNode (Cons (TwoRight left k v) ctx) right
227227 removeMaxNode ctx (Three Leaf k1 v1 Leaf _ _ Leaf ) = up (Cons (TwoRight Leaf k1 v1) ctx) Leaf
0 commit comments