insert x t@(Bin s a l r) = case x `compare` a of
  LT -> let l' = insert x l in Bin (s + size l' - size l) a l' r
  GT -> let r' = insert x r in Bin (s + size r' - size r) a l r'
  EQ -> t
insert x t@(Bin s a l r) = case x `compare` a of
  LT -> let l' = insert x l in Bin (s + size l' - size l) a l' r
  GT -> let r' = insert x r in Bin (s + size r' - size r) a l r'
  EQ -> t
insert x t@(Bin s a l r) = case x `compare` a of
  LT -> let l' = insert x l in Bin (s + size l' - size l) a l' r
  GT -> let r' = insert x r in Bin (s + size r' - size r) a l r'
  EQ -> t