Proposal to Contribute an Exhaustive Error Check Helper to Effect Library

After my talk at Effect days, I already had one person asking for the code snippet implementing the exhaustive error check. I was wondering, if it was of any value to try and contribute it back to Effect. I've refined its implementation even further using the effect/Function module:

import { type Effect } from "effect"
import { satisfies } from "effect/Function"

export const exhaustiveErrorCheck = satisfies<Effect.Effect<any, never, any>>()


The idea is to make it easy to enforce exhaustive error handling without having to type out satisfies Effect.Effect<MySuccessType, never, MyRequirements>. I usually reach for this helper in my Kafka consumers at the very top of the message handler, so I can make the decision of whether to retry or discard the message in a single central place. Would anybody else find value in this helper being exported from Effect? If so, would you prefer it to be a standalone function (as suggested above), or like
pipe
be part of the Effect interface, i.e.:

// @ts-expect-error
Effect.fail(new Error()).exhaustiveErrorCheck()

// compiles
Effect.succeed(42).exhaustiveErrorCheck()


I'm also very open to suggestions for a more intuitive name.
Was this page helpful?