Hyperlinkv0.8.0-beta.28

Combiner

Combiner.lastfunctioneffect/Combiner.ts:245
<A>(): Combiner<A>

Creates a Combiner that always returns the last (right) argument.

When to use

Use when you want "last write wins" semantics while merging values.

Details

combine(self, that) returns that and ignores self.

Example (Keeping the last value)

import { Combiner } from "effect"

const Last = Combiner.last<number>()

console.log(Last.combine(1, 2))
// Output: 2
constructorsfirst
export function last<A>(): Combiner<A> {
  return make((_, that) => that)
}