0 | module Data.Traversable
 1 |
 2 | import Control.Monad.Identity
 3 | import Data.Functor.Const
 4 | import Data.Morphisms
 5 |
 6 | public export
 7 | mapDefault : Traversable t => (a -> b) -> t a -> t b
 8 | mapDefault f = runIdentity . traverse (Id . f)
 9 |
10 | public export
11 | foldrDefault : Traversable t => (a -> acc -> acc) -> acc -> t a -> acc
12 | foldrDefault f acc t =
13 |   (applyEndo . getConst $ traverse (MkConst {b = ()} . Endo . f) t) acc
14 |