Foldable package:first-class-families

Foldable types. A minimal implementation of this interface is given by either FoldMap or Foldr, but a default still needs to be given explicitly for the other.
data MyType a = ... {- Some custom Foldable type -}

-- Method 1: Implement Foldr, default FoldMap.
type instance Eval (Foldr f y xs) = ... {- Explicit implementation -}
type instance Eval (FoldMap f xs) = FoldMapDefault_ f xs {- Default -}

-- Method 2: Implement FoldMap, default Foldr.
type instance Eval (FoldMap f xs) = ... {- Explicit implementation -}
type instance Eval (Foldr f y xs) = FoldrDefault_ f y xs {- Default -}