// ets_tracing: off
import * as core from "../../../../Effect/core.js"
import type { Effect } from "../../../../Effect/effect.js"
import * as forEach from "../../../../Effect/excl-forEach.js"
import * as coreMap from "../../../../Effect/map.js"
import * as List from "../core.js"
/**
* Effectfully maps the elements of this list.
*/
export function mapM_(
self: List.List,
f: (a: A) => Effect
): Effect> {
return core.suspend(() => {
const builder = List.emptyPushable()
return coreMap.map_(
forEach.forEachUnit_(self, (a) =>
coreMap.map_(f(a), (b) => {
List.push_(builder, b)
})
),
() => builder
)
})
}
/**
* Effectfully maps the elements of this list.
*
* @ets_data_first mapM_
*/
export function mapM(
f: (a: A) => Effect
): (self: List.List) => Effect> {
return (self) => mapM_(self, f)
}