Skip to content

Commit e3a3ba5

Browse files
committed
Move eff package to local scope
1 parent 0bab272 commit e3a3ba5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2415
-2545
lines changed

.pkgs/eff/docs/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Public APIs
2+
3+
## Type Aliases
4+
5+
| Type Alias | Description |
6+
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
7+
| [NarrowedTo](type-aliases/NarrowedTo.md) | An extension of Extract for type predicates which falls back to the base in order to narrow the `unknown` case. |
8+
| [Pretty](type-aliases/Pretty.md) | - |
9+
| [unit](type-aliases/unit.md) | alias for `undefined`. |
10+
11+
## Variables
12+
13+
| Variable | Description |
14+
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15+
| [compose](variables/compose.md) | Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`. The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`. |
16+
| [dual](variables/dual.md) | Creates a function that can be used in a data-last (aka `pipe`able) or data-first style. |
17+
| [unit](variables/unit.md) | alias for `undefined`. |
18+
19+
## Functions
20+
21+
| Function | Description |
22+
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23+
| [absurd](functions/absurd.md) | The `absurd` function is a stub for cases where a value of type `never` is encountered in your code, meaning that it should be impossible for this code to be executed. |
24+
| [apply](functions/apply.md) | Apply a function to a given value. |
25+
| [constant](functions/constant.md) | Returns a function that always returns the same value. |
26+
| [constFalse](functions/constFalse.md) | Do nothing and return `false`. |
27+
| [constNull](functions/constNull.md) | Do nothing and return `null`. |
28+
| [constTrue](functions/constTrue.md) | Do nothing and return `true`. |
29+
| [constVoid](functions/constVoid.md) | Do nothing and return `void`. |
30+
| [flip](functions/flip.md) | Reverses the order of arguments for a curried function. |
31+
| [flow](functions/flow.md) | Performs left-to-right function composition. The first argument may have any arity, the remaining arguments must be unary. |
32+
| [getOrElse](functions/getOrElse.md) | Retrieves a value from a Map or WeakMap if the key exists, or computes a new value if it doesn't. |
33+
| [getOrElseUpdate](functions/getOrElseUpdate.md) | Retrieves a value from a Map or WeakMap if the key exists, or computes and stores a new value if it doesn't. |
34+
| [identity](functions/identity.md) | Returns its argument. |
35+
| [isArray](functions/isArray.md) | A function that checks if the passed parameter is an Array and narrows its type accordingly. |
36+
| [isFunction](functions/isFunction.md) | Tests if a value is a `function`. |
37+
| [isObject](functions/isObject.md) | Checks if the given parameter is of type `"object"` via `typeof`, excluding `null`. |
38+
| [isTruthy](functions/isTruthy.md) | A function that checks if the passed parameter is truthy and narrows its type accordingly. |
39+
| [not](functions/not.md) | A function that takes a guard function as predicate and returns a guard that negates it. |
40+
| [or](functions/or.md) | A function that takes two guard functions as predicates and returns a guard that checks if either of them is true. |
41+
| [pipe](functions/pipe.md) | Pipes the value of an expression into a pipeline of functions. |
42+
| [pipeArguments](functions/pipeArguments.md) | - |
43+
| [tryAddToSet](functions/tryAddToSet.md) | Attempts to add a value to a Set, but only if it doesn't already exist. |
44+
| [tupled](functions/tupled.md) | Creates a version of this function: instead of `n` arguments, it accepts a single tuple argument. |
45+
| [untupled](functions/untupled.md) | Inverse function of `tupled`. |
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ This function is particularly useful when it's necessary to specify that certain
1414
## Type Parameters
1515

1616
| Type Parameter |
17-
| ------ |
18-
| `A` |
17+
| -------------- |
18+
| `A` |
1919

2020
## Parameters
2121

22-
| Parameter | Type | Description |
23-
| ------ | ------ | ------ |
24-
| `_` | `never` | The value of type `never` that is passed to the function. |
22+
| Parameter | Type | Description |
23+
| --------- | ------- | --------------------------------------------------------- |
24+
| `_` | `never` | The value of type `never` that is passed to the function. |
2525

2626
## Returns
2727

.pkgs/eff/docs/functions/apply.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[Public APIs](../README.md) / apply
2+
3+
# Function: apply()
4+
5+
```ts
6+
function apply<A>(a: A): <B>(self: (a: A) => B) => B;
7+
```
8+
9+
Apply a function to a given value.
10+
11+
## Type Parameters
12+
13+
| Type Parameter |
14+
| -------------- |
15+
| `A` |
16+
17+
## Parameters
18+
19+
| Parameter | Type | Description |
20+
| --------- | ---- | ------------------- |
21+
| `a` | `A` | The value to apply. |
22+
23+
## Returns
24+
25+
```ts
26+
<B>(self: (a: A) => B): B;
27+
```
28+
29+
### Type Parameters
30+
31+
| Type Parameter |
32+
| -------------- |
33+
| `B` |
34+
35+
### Parameters
36+
37+
| Parameter | Type |
38+
| --------- | ----------------- |
39+
| `self` | (`a`: `A`) => `B` |
40+
41+
### Returns
42+
43+
`B`
44+
45+
## Example
46+
47+
```ts
48+
import { apply, pipe } from "effect/Function";
49+
import { length } from "effect/String";
50+
import * as assert from "node:assert";
51+
52+
assert.deepStrictEqual(pipe(length, apply("hello")), 5);
53+
```
54+
55+
## Since
56+
57+
1.0.0
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Returns a function that always returns the same value.
1111
## Type Parameters
1212

1313
| Type Parameter |
14-
| ------ |
15-
| `T` |
14+
| -------------- |
15+
| `T` |
1616

1717
## Parameters
1818

19-
| Parameter | Type | Description |
20-
| ------ | ------ | ------ |
21-
| `x` | `T` | The value to return. |
19+
| Parameter | Type | Description |
20+
| --------- | ---- | -------------------- |
21+
| `x` | `T` | The value to return. |
2222

2323
## Returns
2424

.pkgs/eff/docs/functions/flip.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[Public APIs](../README.md) / flip
2+
3+
# Function: flip()
4+
5+
```ts
6+
function flip<A, B, C>(f: (...a: A) => (...b: B) => C): (...b: B) => (...a: A) => C;
7+
```
8+
9+
Reverses the order of arguments for a curried function.
10+
11+
## Type Parameters
12+
13+
| Type Parameter |
14+
| ------------------------- |
15+
| `A` _extends_ `unknown`[] |
16+
| `B` _extends_ `unknown`[] |
17+
| `C` |
18+
19+
## Parameters
20+
21+
| Parameter | Type | Description |
22+
| --------- | ------------------------------------- | --------------------- |
23+
| `f` | (...`a`: `A`) => (...`b`: `B`) => `C` | The function to flip. |
24+
25+
## Returns
26+
27+
```ts
28+
(...b: B): (...a: A) => C;
29+
```
30+
31+
### Parameters
32+
33+
| Parameter | Type |
34+
| --------- | ---- |
35+
| ...`b` | `B` |
36+
37+
### Returns
38+
39+
```ts
40+
(...a: A): C;
41+
```
42+
43+
#### Parameters
44+
45+
| Parameter | Type |
46+
| --------- | ---- |
47+
| ...`a` | `A` |
48+
49+
#### Returns
50+
51+
`C`
52+
53+
## Example
54+
55+
```ts
56+
import { flip } from "effect/Function";
57+
import * as assert from "node:assert";
58+
59+
const f = (a: number) => (b: string) => a - b.length;
60+
61+
assert.deepStrictEqual(flip(f)("aaa")(2), -1);
62+
```
63+
64+
## Since
65+
66+
1.0.0

0 commit comments

Comments
 (0)