Data.Traversable in Core (or other library)?

I often find myself wanting a more generic mapM operation over monads. Something similar to what Data.Traversable provides in Haskell.

To date, I replicate this functionality by converting the traversable structure to a list and then implementing the list-specialized mapM by mapping the monadic operation over the list and then using Core.Monad.all:

let mapM (f : 'a -> 'b M.t) (l : 'a list) : 'b list M.t =
  M.all (List.map f l)

Is there a library hidden on opam somewhere that provides this interface + integrates nicely with Core monads? Is this something that has been considered for Core?

1 Like

Clarity does have functorized Traversable interface and instances for List and Vector types.

1 Like