This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Description
These functions can be easily made tail-recursive.
findMax :: forall k v. Map k v -> Maybe { key :: k, value :: v }
findMax = go Nothing
where
go acc Leaf = acc
go _ (Two _ k1 v1 right) = go (Just { key: k1, value: v1 }) right
go _ (Three _ _ _ _ k2 v2 right) = go (Just { key: k2, value: v2 }) right