Skip to content

Commit

Permalink
fix the tacit use of some NonEmpty unfied APIs (#1726)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Dec 1, 2023
1 parent 1884fa3 commit 1152a2c
Show file tree
Hide file tree
Showing 19 changed files with 598 additions and 183 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-suits-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray: fix the tacit use of unzip
5 changes: 5 additions & 0 deletions .changeset/fresh-ducks-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray: fix the tacit use of reverse
5 changes: 5 additions & 0 deletions .changeset/good-bears-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray: fix the tacit use of dedupe
5 changes: 5 additions & 0 deletions .changeset/odd-fireants-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

Chunk > flatMap: fix return type
5 changes: 5 additions & 0 deletions .changeset/rare-bulldogs-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray: fix sortBy signature
5 changes: 5 additions & 0 deletions .changeset/rare-pens-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray: fix chop signature
5 changes: 5 additions & 0 deletions .changeset/rich-peaches-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

List > flatMap: fix return type
5 changes: 5 additions & 0 deletions .changeset/twelve-worms-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray: fix dedupeWith signature
5 changes: 5 additions & 0 deletions .changeset/unlucky-colts-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ReadonlyArray > flatMap: fix return type
45 changes: 32 additions & 13 deletions docs/modules/Chunk.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ Added in v2.0.0
- [unsafeLast](#unsafelast)
- [utils](#utils)
- [Chunk (namespace)](#chunk-namespace)
- [AndNonEmpty (type alias)](#andnonempty-type-alias)
- [Flatten (type alias)](#flatten-type-alias)
- [Infer (type alias)](#infer-type-alias)
- [OrNonEmpty (type alias)](#ornonempty-type-alias)
- [With (type alias)](#with-type-alias)
- [With2 (type alias)](#with2-type-alias)
- [drop](#drop)
- [dropRight](#dropright)
- [dropWhile](#dropwhile)
Expand Down Expand Up @@ -160,7 +161,9 @@ If either chunk is non-empty, the result is also a non-empty chunk.
```ts
export declare const appendAll: {
<S extends Chunk<any>, T extends Chunk<any>>(that: T): (self: S) => Chunk.With2<S, T, Chunk.Infer<S> | Chunk.Infer<T>>
<S extends Chunk<any>, T extends Chunk<any>>(
that: T
): (self: S) => Chunk.OrNonEmpty<S, T, Chunk.Infer<S> | Chunk.Infer<T>>
<A, B>(self: Chunk<A>, that: NonEmptyChunk<B>): NonEmptyChunk<A | B>
<A, B>(self: NonEmptyChunk<A>, that: Chunk<B>): NonEmptyChunk<A | B>
<A, B>(self: Chunk<A>, that: Chunk<B>): Chunk<A | B>
Expand Down Expand Up @@ -201,7 +204,9 @@ If either chunk is non-empty, the result is also a non-empty chunk.
```ts
export declare const prependAll: {
<S extends Chunk<any>, T extends Chunk<any>>(that: T): (self: S) => Chunk.With2<S, T, Chunk.Infer<S> | Chunk.Infer<T>>
<S extends Chunk<any>, T extends Chunk<any>>(
that: T
): (self: S) => Chunk.OrNonEmpty<S, T, Chunk.Infer<S> | Chunk.Infer<T>>
<A, B>(self: Chunk<A>, that: NonEmptyChunk<B>): NonEmptyChunk<A | B>
<A, B>(self: NonEmptyChunk<A>, that: Chunk<B>): NonEmptyChunk<A | B>
<A, B>(self: Chunk<A>, that: Chunk<B>): Chunk<A | B>
Expand Down Expand Up @@ -1033,7 +1038,7 @@ Applies a function to each element in a chunk and returns a new chunk containing
export declare const flatMap: {
<S extends Chunk<any>, T extends Chunk<any>>(
f: (a: Chunk.Infer<S>, i: number) => T
): (self: S) => Chunk.With2<S, T, Chunk.Infer<T>>
): (self: S) => Chunk.AndNonEmpty<S, T, Chunk.Infer<T>>
<A, B>(self: NonEmptyChunk<A>, f: (a: A, i: number) => NonEmptyChunk<B>): NonEmptyChunk<B>
<A, B>(self: Chunk<A>, f: (a: A, i: number) => Chunk<B>): Chunk<B>
}
Expand All @@ -1048,7 +1053,7 @@ Flattens a chunk of chunks into a single chunk by concatenating all chunks.
**Signature**
```ts
export declare const flatten: <T extends Chunk<Chunk<any>>>(self: T) => Chunk.Flatten<T>
export declare const flatten: <S extends Chunk<Chunk<any>>>(self: S) => Chunk.Flatten<S>
```
Added in v2.0.0
Expand Down Expand Up @@ -1147,6 +1152,20 @@ Added in v2.0.0
Added in v2.0.0
### AndNonEmpty (type alias)
**Signature**
```ts
export type AndNonEmpty<S extends Chunk<any>, T extends Chunk<any>, A> = S extends NonEmptyChunk<any>
? T extends NonEmptyChunk<any>
? NonEmptyChunk<A>
: Chunk<A>
: Chunk<A>
```
Added in v2.0.0
### Flatten (type alias)
**Signature**
Expand All @@ -1171,26 +1190,26 @@ export type Infer<S extends Chunk<any>> = S extends Chunk<infer A> ? A : never
Added in v2.0.0
### With (type alias)
### OrNonEmpty (type alias)
**Signature**
```ts
export type With<S extends Chunk<any>, A> = S extends NonEmptyChunk<any> ? NonEmptyChunk<A> : Chunk<A>
export type OrNonEmpty<S extends Chunk<any>, T extends Chunk<any>, A> = S extends NonEmptyChunk<any>
? NonEmptyChunk<A>
: T extends NonEmptyChunk<any>
? NonEmptyChunk<A>
: Chunk<A>
```
Added in v2.0.0
### With2 (type alias)
### With (type alias)
**Signature**
```ts
export type With2<S extends Chunk<any>, T extends Chunk<any>, A> = S extends NonEmptyChunk<any>
? NonEmptyChunk<A>
: T extends NonEmptyChunk<any>
? NonEmptyChunk<A>
: Chunk<A>
export type With<S extends Chunk<any>, A> = S extends NonEmptyChunk<any> ? NonEmptyChunk<A> : Chunk<A>
```
Added in v2.0.0
Expand Down
39 changes: 27 additions & 12 deletions docs/modules/List.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ Added in v2.0.0
- [unsafeTail](#unsafetail)
- [utils](#utils)
- [List (namespace)](#list-namespace)
- [AndNonEmpty (type alias)](#andnonempty-type-alias)
- [Infer (type alias)](#infer-type-alias)
- [OrNonEmpty (type alias)](#ornonempty-type-alias)
- [With (type alias)](#with-type-alias)
- [With2 (type alias)](#with2-type-alias)

---

Expand Down Expand Up @@ -256,7 +257,7 @@ If either list is non-empty, the result is also a non-empty list.
```ts
export declare const appendAll: {
<S extends List<any>, T extends List<any>>(that: T): (self: S) => List.With2<S, T, List.Infer<S> | List.Infer<T>>
<S extends List<any>, T extends List<any>>(that: T): (self: S) => List.OrNonEmpty<S, T, List.Infer<S> | List.Infer<T>>
<A, B>(self: List<A>, that: Cons<B>): Cons<A | B>
<A, B>(self: Cons<A>, that: List<B>): Cons<A | B>
<A, B>(self: List<A>, that: List<B>): List<A | B>
Expand Down Expand Up @@ -297,7 +298,7 @@ If either list is non-empty, the result is also a non-empty list.
```ts
export declare const prependAll: {
<S extends List<any>, T extends List<any>>(that: T): (self: S) => List.With2<S, T, List.Infer<S> | List.Infer<T>>
<S extends List<any>, T extends List<any>>(that: T): (self: S) => List.OrNonEmpty<S, T, List.Infer<S> | List.Infer<T>>
<A, B>(self: List<A>, that: Cons<B>): Cons<A | B>
<A, B>(self: Cons<A>, that: List<B>): Cons<A | B>
<A, B>(self: List<A>, that: List<B>): List<A | B>
Expand Down Expand Up @@ -604,8 +605,8 @@ Applies the specified mapping function to each element of the list.
```ts
export declare const map: {
<T extends List<any>, B>(f: (a: List.Infer<T>, i: number) => B): (self: T) => List.With<T, B>
<T extends List<any>, B>(self: T, f: (a: List.Infer<T>, i: number) => B): List.With<T, B>
<S extends List<any>, B>(f: (a: List.Infer<S>, i: number) => B): (self: S) => List.With<S, B>
<S extends List<any>, B>(self: S, f: (a: List.Infer<S>, i: number) => B): List.With<S, B>
}
```
Expand Down Expand Up @@ -707,7 +708,7 @@ Applies a function to each element in a list and returns a new list containing t
export declare const flatMap: {
<S extends List<any>, T extends List<any>>(
f: (a: List.Infer<S>, i: number) => T
): (self: S) => List.With2<S, T, List.Infer<T>>
): (self: S) => List.AndNonEmpty<S, T, List.Infer<T>>
<A, B>(self: Cons<A>, f: (a: A, i: number) => Cons<B>): Cons<B>
<A, B>(self: List<A>, f: (a: A, i: number) => List<B>): List<B>
}
Expand Down Expand Up @@ -781,36 +782,50 @@ Added in v2.0.0
Added in v2.0.0
### Infer (type alias)
### AndNonEmpty (type alias)
**Signature**
```ts
export type Infer<T extends List<any>> = T extends List<infer A> ? A : never
export type AndNonEmpty<S extends List<any>, T extends List<any>, A> = S extends Cons<any>
? T extends Cons<any>
? Cons<A>
: List<A>
: List<A>
```
Added in v2.0.0
### With (type alias)
### Infer (type alias)
**Signature**
```ts
export type With<T extends List<any>, A> = T extends Cons<any> ? Cons<A> : List<A>
export type Infer<S extends List<any>> = S extends List<infer A> ? A : never
```
Added in v2.0.0
### With2 (type alias)
### OrNonEmpty (type alias)
**Signature**
```ts
export type With2<S extends List<any>, T extends List<any>, A> = S extends Cons<any>
export type OrNonEmpty<S extends List<any>, T extends List<any>, A> = S extends Cons<any>
? Cons<A>
: T extends Cons<any>
? Cons<A>
: List<A>
```
Added in v2.0.0
### With (type alias)
**Signature**
```ts
export type With<S extends List<any>, A> = S extends Cons<any> ? Cons<A> : List<A>
```
Added in v2.0.0
Loading

0 comments on commit 1152a2c

Please sign in to comment.