<N extends Newtype.Any>(
combiner: Combiner.Combiner<Newtype.Carrier<N>>
): Combiner.Combiner<N>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) // 30export const const makeCombiner: <
N extends Newtype.Any
>(
combiner: Combiner.Combiner<Newtype.Carrier<N>>
) => Combiner.Combiner<N>
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
makeCombiner: <function (type parameter) N in <N extends Newtype.Any>(combiner: Combiner.Combiner<Newtype.Carrier<N>>): Combiner.Combiner<N>N extends Newtype.type Newtype<in out Key extends string, out Carrier>.Any = Newtype<any, unknown>A type that matches any Newtype, useful as a generic constraint:
<N extends Newtype.Any>.
When to use
Use as a generic constraint when a type parameter can be any Newtype.
Any>(
combiner: Combiner.Combiner<Newtype.Carrier<N>>(parameter) combiner: {
combine: (self: A, that: A) => A;
}
combiner: import CombinerCombiner.type Combiner.Combiner = /*unresolved*/ anyCombiner<Newtype.type Newtype<in out Key extends string, out Carrier>.Carrier<N extends Newtype.Any> = N extends Newtype<infer _Key extends string, infer Carrier> ? Carrier : neverExtracts the carrier (underlying) type from a newtype.
When to use
Use when you need to refer to the wrapped type in generic utilities.
Carrier<function (type parameter) N in <N extends Newtype.Any>(combiner: Combiner.Combiner<Newtype.Carrier<N>>): Combiner.Combiner<N>N>>
) => import CombinerCombiner.type Combiner.Combiner = /*unresolved*/ anyCombiner<function (type parameter) N in <N extends Newtype.Any>(combiner: Combiner.Combiner<Newtype.Carrier<N>>): Combiner.Combiner<N>N> = import castcast