diff --git a/.changeset/chatty-moons-hammer.md b/.changeset/chatty-moons-hammer.md new file mode 100644 index 0000000000..ea45fb1f80 --- /dev/null +++ b/.changeset/chatty-moons-hammer.md @@ -0,0 +1,5 @@ +--- +"effect": minor +--- + +make List.Cons extend NonEmptyIterable diff --git a/packages/effect/src/List.ts b/packages/effect/src/List.ts index 0f9f278cb9..9f6e7e90bf 100644 --- a/packages/effect/src/List.ts +++ b/packages/effect/src/List.ts @@ -29,6 +29,7 @@ import * as Equivalence from "./Equivalence.js" import { dual, identity, unsafeCoerce } from "./Function.js" import * as Hash from "./Hash.js" import { format, type Inspectable, NodeInspectSymbol, toJSON } from "./Inspectable.js" +import type { nonEmpty, NonEmptyIterable } from "./NonEmptyIterable.js" import * as Option from "./Option.js" import type { Pipeable } from "./Pipeable.js" import { pipeArguments } from "./Pipeable.js" @@ -72,7 +73,7 @@ export interface Nil extends Iterable, Equal.Equal, Pipeable, Inspecta * @since 2.0.0 * @category models */ -export interface Cons extends Iterable, Equal.Equal, Pipeable, Inspectable { +export interface Cons extends NonEmptyIterable, Equal.Equal, Pipeable, Inspectable { readonly [TypeId]: TypeId readonly _tag: "Cons" readonly head: A @@ -96,7 +97,7 @@ export const getEquivalence = (isEquivalent: Equivalence.Equivalence): Equ const _equivalence = getEquivalence(Equal.equals) -const ConsProto: Omit, "head" | "tail"> = { +const ConsProto: Omit, "head" | "tail" | typeof nonEmpty> = { [TypeId]: TypeId, _tag: "Cons", toString(this: Cons) {