I started like this data C a = C { insert :: a -> Maybe (C a), remove :: Maybe (a, C a) } but I could not implement anything sensible on top of this.