import * as tracing_1 from "../../Tracing"
const fileName_1 = "(@effect-ts/system): _src/Testing/TestAnnotation/index.ts"
import * as Chunk from "../../Collections/Immutable/Chunk"
import * as List from "../../Collections/Immutable/List"
import * as E from "../../Either"
import { tag } from "../../Has"
import * as St from "../../Structural"
import { Int } from "../Int"
/**
 * A type of annotation.
 */

export class TestAnnotation {
  constructor(identifier, initial, combine, tag) {
    this.identifier = identifier
    this.initial = initial
    this.combine = combine
    this.tag = tag
  }

  get [St.hashSym]() {
    return St.combineHash(St.hash(this.identifier), St.hash(this.tag))
  }

  [St.equalsSym](that) {
    return (
      that instanceof TestAnnotation &&
      St.equals(this.identifier, that.identifier) &&
      St.equals(this.tag, that.tag)
    )
  }
}
export const FibersAnnotation = /*#__PURE__*/ tag()
export const fibers = /*#__PURE__*/ new TestAnnotation(
  "fibers",
  /*#__PURE__*/ E.left(0),
  compose,
  FibersAnnotation
)

function compose(left, right) {
  if (left._tag === "Left" && right._tag === "Left") {
    return E.left(Int(left.left + right.left))
  } else if (left._tag === "Right" && right._tag === "Right") {
    return E.right(Chunk.concat_(left.right, right.right))
  } else if (left._tag === "Right" && right._tag === "Left") {
    return E.left(right.left)
  } else {
    return E.right(right.right)
  }
}

export const LocationAnnotation = /*#__PURE__*/ tag()
export const location = /*#__PURE__*/ new TestAnnotation(
  "location",
  /*#__PURE__*/ List.empty(),
  List.concat_,
  LocationAnnotation
)
//# sourceMappingURL=index.js.map
