import * as Tp from "@effect-ts/core/Collections/Immutable/Tuple";
import { identity } from "@effect-ts/core/Function";
import { matchTag_ } from "@effect-ts/core/Utils";
import { Continue, CurrentLast, Stop } from "./definition.mjs"; // -----------------------------------------------------------------------------
// Operations
// -----------------------------------------------------------------------------

export function map_(self, f) {
  return matchTag_(self, {
    Continue: _ => new Continue({
      value: f(_.value)
    }),
    CurrentLast: _ => new CurrentLast({
      value: f(_.value)
    })
  }, identity);
}
/**
 * @ets_data_first map_
 */

export function map(f) {
  return self => map_(self, f);
}
export function zipBoth_(fa, fb) {
  if (fa._tag === "Stop" || fb._tag === "Stop") {
    return new Stop();
  }

  if (fa._tag === "Continue" && fb._tag === "Continue") {
    return new Continue({
      value: Tp.tuple(fa.value, fb.value)
    });
  }

  return new CurrentLast({
    value: Tp.tuple(fa.value, fb.value)
  });
}
/**
 * @ets_data_first zipBoth_
 */

export function zipBoth(fb) {
  return fa => zipBoth_(fa, fb);
}
//# sourceMappingURL=operations.mjs.map