import * as tracing_1 from "../../Tracing"
const fileName_1 = "(@effect-ts/system): _src/Managed/methods/preallocationScope.ts"
import { map_ } from "../core"
import * as T from "../deps-core"
import { makeExit_ } from "../makeExit"
import { scope } from "./api"
/**
 * Creates a scope in which resources can be safely preallocated.
 */

export const preallocationScope = /*#__PURE__*/ map_(
  scope,
  (allocate) => (managed) =>
    T.map_(
      allocate(managed),
      ({ tuple: [release, res] }) =>
        makeExit_(
          T.succeed(res, fileName_1 + ":24:28"),
          (_, exit) => release(exit),
          fileName_1 + ":24:18"
        ),
      fileName_1 + ":23:13"
    ),
  fileName_1 + ":19:84"
)
//# sourceMappingURL=preallocationScope.js.map
