I couldn’t find any function that allows me to map over a list with the second argument for the function being the index of the element. In other languages this is sometimes known as mapi. Is there anything like that in Daml?
import Prelude hiding (mapA)
import DA.Action.State
import DA.Traversable
mapI : Traversable t => (a -> Int -> b) -> t a -> t b
mapI f xs = mapA (\a -> State \n -> (f a n, n + 1)) xs `evalState` 0