-- Insert is WRONG! see EQ case that throws existing k v. 

insert :: Ord k => k -> v -> Apo.CoEndo (F.Tree k v)
insert k v = Apo.Phi $ \(InF s) ->
  case s of
    F.Branch m w l r ->
      case k `compare` m of
        LT -> F.Branch m w (Left  l)            (Left  r)
        EQ -> F.Branch k v (Right l)            (Left  r)
        GT -> F.Branch m w (Right l)            (Right r)
    F.Leaf -> F.Branch k v (Right (InF F.Leaf)) (Right (InF F.Leaf))
insert :: Ord k => k -> v -> Apo.CoEndo (F.Tree k v)
insert k v = Apo.Phi $ \(InF s) ->
  case s of
    F.Branch m w l r ->
      case k `compare` m of
        LT -> F.Branch m w (Left  l)            (Left  r)
        EQ -> F.Branch k v (Right l)            (Left  r)
        GT -> F.Branch m w (Right l)            (Right r)
    F.Leaf -> F.Branch k v (Right (InF F.Leaf)) (Right (InF F.Leaf))
insert k v = Apo.Phi $ \(InF s) ->
  case s of
    F.Branch m w l r ->
      case k `compare` m of
        LT -> F.Branch m w (Left  l)            (Left  r)
        EQ -> F.Branch k v (Right l)            (Left  r)
        GT -> F.Branch m w (Right l)            (Right r)
    F.Leaf -> F.Branch k v (Right (InF F.Leaf)) (Right (InF F.Leaf))