{
  "id": "@typed/fx/Fx#flip",
  "canonicalId": "@typed/fx/Fx#flip",
  "symbol": {
    "id": "@typed/fx/Fx#flip",
    "packageName": "@typed/fx",
    "moduleName": "Fx",
    "exportName": "flip",
    "kind": "constant",
    "signatures": [
      "export declare const flip: <A, E, R>(fx: Fx<A, E, R>) => Fx<E, A, R>;"
    ],
    "summary": "Emits typed failures as values and fails with the first successful value.",
    "sections": {
      "Why": "Channel inversion makes an error-producing computation composable through\nsuccess operators, mirroring Effect's `flip` without erasing either type.",
      "Ownership and lifetime": "If a source Cause contains any Fail, the first typed error `e` is delivered\nas success and the entire Cause is discarded, including defects or interrupts\ncomposed beside that Fail. A Cause with no Fail propagates unchanged. A source\nsuccess `a` terminates the returned Fx with typed failure `a`. The source\nsubscription is the only lifetime and external interruption still stops it."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { flip } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst errorsAsValues = flip(fail(\"offline\"))"
      },
      {
        "language": "text",
        "code": "The first Fail wins over the rest of a composite Cause\n```ts\nimport { Cause } from \"effect\"\nimport { flip } from \"@typed/fx/Fx\"\nimport { failCause } from \"@typed/fx/Fx\"\n\nconst composite = Cause.combine(Cause.fail(\"offline\"), Cause.die(\"decoder defect\"))\nconst errorValue = flip(failCause(composite))\n```"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/flip.ts",
      "line": 45
    },
    "since": "1.0.0",
    "category": "Errors and recovery"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Fx#flip",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "Fx",
    "consumerSpecifier": "@typed/fx/Fx",
    "exportName": "flip",
    "qualifiedName": "flip",
    "declarationKey": "declaration:03f57b7e70fdd6c165d05973",
    "family": "variable",
    "signatures": [
      "export declare const flip: <A, E, R>(fx: Fx<A, E, R>) => Fx<E, A, R>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/flip.ts",
        "start": {
          "line": 45,
          "column": 14
        },
        "end": {
          "line": 46,
          "column": 55
        }
      }
    ],
    "aliases": [
      "@typed/fx#Fx.flip"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:03f57b7e70fdd6c165d05973",
    "name": "flip",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const flip: <A, E, R>(fx: Fx<A, E, R>) => Fx<E, A, R>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/flip.ts",
            "start": {
              "line": 45,
              "column": 14
            },
            "end": {
              "line": 46,
              "column": 55
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const flip: <A, E, R>(fx: Fx<A, E, R>) => Fx<E, A, R>;"
    ],
    "typeParameters": [],
    "summary": "Emits typed failures as values and fails with the first successful value.",
    "sections": {
      "Why": "Channel inversion makes an error-producing computation composable through\nsuccess operators, mirroring Effect's `flip` without erasing either type.",
      "Ownership and lifetime": "If a source Cause contains any Fail, the first typed error `e` is delivered\nas success and the entire Cause is discarded, including defects or interrupts\ncomposed beside that Fail. A Cause with no Fail propagates unchanged. A source\nsuccess `a` terminates the returned Fx with typed failure `a`. The source\nsubscription is the only lifetime and external interruption still stops it."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { flip } from \"@typed/fx/Fx\"\nimport { fail } from \"@typed/fx/Fx\"\n\nconst errorsAsValues = flip(fail(\"offline\"))"
      },
      {
        "language": "text",
        "code": "The first Fail wins over the rest of a composite Cause\n```ts\nimport { Cause } from \"effect\"\nimport { flip } from \"@typed/fx/Fx\"\nimport { failCause } from \"@typed/fx/Fx\"\n\nconst composite = Cause.combine(Cause.fail(\"offline\"), Cause.die(\"decoder defect\"))\nconst errorValue = flip(failCause(composite))\n```"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/flip.ts",
        "start": {
          "line": 45,
          "column": 14
        },
        "end": {
          "line": 46,
          "column": 55
        }
      }
    ],
    "since": "1.0.0",
    "category": "Errors and recovery"
  }
}
