// tracing: off
import * as A from "../../Collections/Immutable/Chunk"
import { pipe } from "../../Function"
import * as O from "../../Option"
import * as T from "../_internal/effect"
import * as M from "../_internal/managed"
import * as BP from "../BufferedPull"
import { Stream } from "./definitions"
/**
 * Maps over elements of the stream with the specified effectful function.
 */

export function mapM_(self, f) {
  return new Stream(
    M.map_(M.mapM(BP.make)(self.proc), (pull) =>
      T.chain_(BP.pullElement(pull), (o) => T.bimap(O.some, (o1) => A.single(o1))(f(o)))
    )
  )
}
/**
 * Maps over elements of the stream with the specified effectful function.
 */

export function mapM(f) {
  return (self) => mapM_(self, f)
}
//# sourceMappingURL=mapM.js.map
