On this page
DocumentationSDK

Effect SDK

Each owning calculator definition is a closed program: its rule packs are composed by the owning package, so calculateReport and calculateRun return Effects with no requirements and only the definition's checked error. Your application owns its runtime.

TypeScript
import { Effect } from "effect";
import { AuPayTakeHomeCalculation } from "taxkit/au";
import { TakeHomeScenarioInputSchema } from "taxkit/au/schemas";
import { fromDecimal, nonNegative } from "taxkit/money/effect";
import { calculateRun } from "taxkit/effect";

export const program = Effect.gen(function* () {
  const grossPay = yield* fromDecimal("3462.00").pipe(
    Effect.flatMap(nonNegative)
  );
  const input = TakeHomeScenarioInputSchema.make({
    grossPay,
    period: "fortnightly",
    taxFreeThresholdClaimed: true,
  });
  return yield* calculateRun(AuPayTakeHomeCalculation, input);
});

calculateReport returns the selected report; calculateRun returns the report and diagnostics. Parse unknown data explicitly with decodeInput, which rejects surplus fields. Checked inputs flow through execution without another decoder.

Import actual fact services, rule descriptors and pack Layers from taxkit/au/effect. Native Layer composition keeps missing facts and parameters in the Effect requirements channel. Supply salary sacrifice and an explicit STSL debt status when their selected pack requires them.