Classes for foldable and traversable data structures