Skip to content

Commit

Permalink
make List.Cons extend NonEmptyIterable (#3350)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jul 30, 2024
1 parent e74cc38 commit 1e0fe80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-moons-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": minor
---

make List.Cons extend NonEmptyIterable
5 changes: 3 additions & 2 deletions packages/effect/src/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -72,7 +73,7 @@ export interface Nil<out A> extends Iterable<A>, Equal.Equal, Pipeable, Inspecta
* @since 2.0.0
* @category models
*/
export interface Cons<out A> extends Iterable<A>, Equal.Equal, Pipeable, Inspectable {
export interface Cons<out A> extends NonEmptyIterable<A>, Equal.Equal, Pipeable, Inspectable {
readonly [TypeId]: TypeId
readonly _tag: "Cons"
readonly head: A
Expand All @@ -96,7 +97,7 @@ export const getEquivalence = <A>(isEquivalent: Equivalence.Equivalence<A>): Equ

const _equivalence = getEquivalence(Equal.equals)

const ConsProto: Omit<Cons<unknown>, "head" | "tail"> = {
const ConsProto: Omit<Cons<unknown>, "head" | "tail" | typeof nonEmpty> = {
[TypeId]: TypeId,
_tag: "Cons",
toString(this: Cons<unknown>) {
Expand Down

0 comments on commit 1e0fe80

Please sign in to comment.