Package: effect
Module: Newtype
Lifts a Combiner for the carrier type into a Combiner for the newtype.
When to use
Use when you need to combine newtype-wrapped values with the carrier’s combining logic, without manually unwrapping.
Details
The returned combiner delegates to the provided carrier combiner.
Example (Combining newtypes)
import { Combiner, Newtype } from "effect"
interface Amount extends Newtype.Newtype<"Amount", number> {}
const sum = Combiner.make<number>((a, b) => a + b)
const combiner = Newtype.makeCombiner<Amount>(sum)
const iso = Newtype.makeIso<Amount>()
const total = combiner.combine(iso.set(10), iso.set(20))
Newtype.value(total) // 30
See
makeReducer — lift a Reducer for the carrierSignature
declare const makeCombiner: <N extends Newtype.Any>(combiner: Combiner.Combiner<Newtype.Carrier<N>>) => Combiner.Combiner<N>
Since v4.0.0