aboutsummaryrefslogtreecommitdiff
path: root/docs/interfaces
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-15 00:13:04 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-15 00:13:04 +0530
commitd5c3af89ab8076bcf4107859c1ba6b47a7815142 (patch)
tree1da469a7007fe2cfced0647ae62c1cd003a3fa0d /docs/interfaces
parente75a5a15912b8f297fe9c9747f574486d6c4e334 (diff)
downloadts-types-lang-d5c3af89ab8076bcf4107859c1ba6b47a7815142.tar.gz
ts-types-lang-d5c3af89ab8076bcf4107859c1ba6b47a7815142.zip
chore: some more documentation
Diffstat (limited to 'docs/interfaces')
-rw-r--r--docs/interfaces/effect.Bind.md11
-rw-r--r--docs/interfaces/effect.BindTo.md14
-rw-r--r--docs/interfaces/effect.Do.md9
-rw-r--r--docs/interfaces/effect.Kind1.md4
-rw-r--r--docs/interfaces/effect.Label.md9
-rw-r--r--docs/interfaces/effect.Noop.md4
-rw-r--r--docs/interfaces/effect.Pure.md6
-rw-r--r--docs/interfaces/effect.Seq.md9
-rw-r--r--docs/interfaces/test.AssertEqualsK.md28
-rw-r--r--docs/interfaces/test.Test.md16
-rw-r--r--docs/interfaces/util.ConstK.md4
-rw-r--r--docs/interfaces/util.IdK.md4
12 files changed, 70 insertions, 48 deletions
diff --git a/docs/interfaces/effect.Bind.md b/docs/interfaces/effect.Bind.md
index 334bd5f..bc42d06 100644
--- a/docs/interfaces/effect.Bind.md
+++ b/docs/interfaces/effect.Bind.md
@@ -4,20 +4,23 @@
[effect](../modules/effect.md).Bind
-Generic interface for declaring effects
+Monadic bind an effect to a function (Equivalent to haskell's >>= operator)
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Bind<
+ ReadFile<"./file.txt">,
+ <contents extends string>() => Print<contents>
+>
```
## Type parameters
| Name | Type | Description |
| :------ | :------ | :------ |
-| `_Eff` | extends [`Effect`](effect.Effect.md) | The output generated by the effect (defaults to `unknown`) |
-| `_Fn` | extends [`Func`](../modules/effect.md#func) | - |
+| `_Eff` | extends [`Effect`](effect.Effect.md) | Effect to evaluate first |
+| `_Fn` | extends [`Func`](../modules/effect.md#func) | Function to call with the result of _Eff |
## Hierarchy
diff --git a/docs/interfaces/effect.BindTo.md b/docs/interfaces/effect.BindTo.md
index c333393..0775364 100644
--- a/docs/interfaces/effect.BindTo.md
+++ b/docs/interfaces/effect.BindTo.md
@@ -4,20 +4,26 @@
[effect](../modules/effect.md).BindTo
-Generic interface for declaring effects
+Bind result of evaluating an effect to a label (Equivalent to haskell's <- syntax)
+
+Note: labels are scoped to outermost Do, Bind, Try, etc scopes
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Do<[
+ // contents <- readFile "./file.txt"
+ BindTo<"contents", ReadFile<"./file.txt">>,
+ Bind<Label<"contents">, <c extends string>() => Print<c>>
+]>
```
## Type parameters
| Name | Type | Description |
| :------ | :------ | :------ |
-| `_Name` | extends `string` | The output generated by the effect (defaults to `unknown`) |
-| `_Eff` | extends [`Effect`](effect.Effect.md) | - |
+| `_Name` | extends `string` | The name of label |
+| `_Eff` | extends [`Effect`](effect.Effect.md) | Effect to evaluate |
## Hierarchy
diff --git a/docs/interfaces/effect.Do.md b/docs/interfaces/effect.Do.md
index 504f9c0..1039bc7 100644
--- a/docs/interfaces/effect.Do.md
+++ b/docs/interfaces/effect.Do.md
@@ -4,19 +4,22 @@
[effect](../modules/effect.md).Do
-Generic interface for declaring effects
+Evaluate a sequence of effects in series and get the result of the last effect (Equivalent to haskell's do syntax)
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Bind<
+ Do<[ Pure<1>, ReadFile<"./foobar.txt"> ]>,
+ <t extends string>() => Print<t>
+>
```
## Type parameters
| Name | Type | Description |
| :------ | :------ | :------ |
-| `_Effs` | extends [`Effect`](effect.Effect.md)[] | The output generated by the effect (defaults to `unknown`) |
+| `_Effs` | extends [`Effect`](effect.Effect.md)[] | List of effects |
## Hierarchy
diff --git a/docs/interfaces/effect.Kind1.md b/docs/interfaces/effect.Kind1.md
index 0c8600f..dc0ed2f 100644
--- a/docs/interfaces/effect.Kind1.md
+++ b/docs/interfaces/effect.Kind1.md
@@ -52,7 +52,7 @@ type result = ApplyK<SomeFunc, 200>
#### Defined in
-[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/effect.ts#L35)
+[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/effect.ts#L35)
___
@@ -62,4 +62,4 @@ ___
#### Defined in
-[effect.ts:36](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/effect.ts#L36)
+[effect.ts:36](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/effect.ts#L36)
diff --git a/docs/interfaces/effect.Label.md b/docs/interfaces/effect.Label.md
index f4d9c2c..d007d64 100644
--- a/docs/interfaces/effect.Label.md
+++ b/docs/interfaces/effect.Label.md
@@ -4,19 +4,22 @@
[effect](../modules/effect.md).Label
-Generic interface for declaring effects
+Access a label defined with [BindTo](effect.BindTo.md)
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Do<[
+ BindTo<"contents", ReadFile<"./file.txt">>,
+ Bind<Label<"contents">, <c extends string>() => Print<c>>
+]>
```
## Type parameters
| Name | Type | Description |
| :------ | :------ | :------ |
-| `_Name` | extends `string` | The output generated by the effect (defaults to `unknown`) |
+| `_Name` | extends `string` | The name of label |
## Hierarchy
diff --git a/docs/interfaces/effect.Noop.md b/docs/interfaces/effect.Noop.md
index 79cd0d7..9666460 100644
--- a/docs/interfaces/effect.Noop.md
+++ b/docs/interfaces/effect.Noop.md
@@ -4,12 +4,12 @@
[effect](../modules/effect.md).Noop
-Generic interface for declaring effects
+Noop effect that does nothing (returns undefined)
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Bind<Noop, <t extends undefined>() => Print<t>>
```
## Hierarchy
diff --git a/docs/interfaces/effect.Pure.md b/docs/interfaces/effect.Pure.md
index 69fd304..5e179f3 100644
--- a/docs/interfaces/effect.Pure.md
+++ b/docs/interfaces/effect.Pure.md
@@ -4,19 +4,19 @@
[effect](../modules/effect.md).Pure
-Generic interface for declaring effects
+Wrap a value inside an effect (Equivalent to haskell's pure function)
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Bind<Pure<1>, <t extends number>() => Print<t>>
```
## Type parameters
| Name | Description |
| :------ | :------ |
-| `V` | The output generated by the effect (defaults to `unknown`) |
+| `V` | Value |
## Hierarchy
diff --git a/docs/interfaces/effect.Seq.md b/docs/interfaces/effect.Seq.md
index 3604873..6e52a12 100644
--- a/docs/interfaces/effect.Seq.md
+++ b/docs/interfaces/effect.Seq.md
@@ -4,19 +4,22 @@
[effect](../modules/effect.md).Seq
-Generic interface for declaring effects
+Evaluate a sequence of effects in series and get the list of results
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = Bind<
+ Seq<[ Pure<1>, ReadFile<"./foobar.txt"> ]>,
+ <t extends [number, string]>() => Print<t>
+>
```
## Type parameters
| Name | Type | Description |
| :------ | :------ | :------ |
-| `_Effs` | extends [`Effect`](effect.Effect.md)[] | The output generated by the effect (defaults to `unknown`) |
+| `_Effs` | extends [`Effect`](effect.Effect.md)[] | List of effects |
## Hierarchy
diff --git a/docs/interfaces/test.AssertEqualsK.md b/docs/interfaces/test.AssertEqualsK.md
index b2c2e81..6390521 100644
--- a/docs/interfaces/test.AssertEqualsK.md
+++ b/docs/interfaces/test.AssertEqualsK.md
@@ -4,27 +4,25 @@
[test](../modules/test.md).AssertEqualsK
-An implementation of `* -> *` higher-kinded type
+An alternate point-free api for [AssertEquals](../modules/test.md#assertequals)
-**`Example`**
+**`Type Param`**
-You can define a return property for the function body
- and use `this['input']` to access the argument
- Uses - [ApplyK](../modules/util.md#applyk)
+Right value
-```ts
-interface SomeFunc extends Kind1<number, string> {
- return: `Your number is ${this['input']}`,
-}
+**`Example`**
-type result = ApplyK<SomeFunc, 200>
+```ts
+type main = [
+ Bind<JsExpr<'21 * 3'>, AssertEqualsK<63>>
+]
```
## Type parameters
-| Name | Type | Description |
-| :------ | :------ | :------ |
-| `Right` | extends `unknown` | The input type |
+| Name | Type |
+| :------ | :------ |
+| `Right` | extends `unknown` |
## Hierarchy
@@ -51,7 +49,7 @@ type result = ApplyK<SomeFunc, 200>
#### Defined in
-[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/effect.ts#L35)
+[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/effect.ts#L35)
___
@@ -65,4 +63,4 @@ ___
#### Defined in
-[test.ts:34](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/test.ts#L34)
+[test.ts:77](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/test.ts#L77)
diff --git a/docs/interfaces/test.Test.md b/docs/interfaces/test.Test.md
index b503cc0..583569a 100644
--- a/docs/interfaces/test.Test.md
+++ b/docs/interfaces/test.Test.md
@@ -1,23 +1,29 @@
[ts-types-lang](../README.md) / [Modules](../modules.md) / [test](../modules/test.md) / Test
-# Interface: Test<_m, _effs\>
+# Interface: Test<_M, _Effs\>
[test](../modules/test.md).Test
-Generic interface for declaring effects
+Create a test block
**`Example`**
```ts
-interface MyEffect extends Effect<string[]> {}
+type main = [
+ Test<"should check if result is 21", [
+ Bind<EvalSomeEffect<2, 3>, <a extends number>() => AssertEquals<a, 21>>,
+ // equivalent to...
+ Bind<EvalSomeEffect<2, 3>, AssertEqualsK<21>>,
+ ]>
+]
```
## Type parameters
| Name | Type | Description |
| :------ | :------ | :------ |
-| `_m` | extends `string` | The output generated by the effect (defaults to `unknown`) |
-| `_effs` | extends [`Effect`](effect.Effect.md)[] | - |
+| `_M` | extends `string` | description of the test |
+| `_Effs` | extends [`Effect`](effect.Effect.md)[] | List of effects to evaluate |
## Hierarchy
diff --git a/docs/interfaces/util.ConstK.md b/docs/interfaces/util.ConstK.md
index 71db6c3..1b42f9c 100644
--- a/docs/interfaces/util.ConstK.md
+++ b/docs/interfaces/util.ConstK.md
@@ -51,7 +51,7 @@ type result = ApplyK<SomeFunc, 200>
#### Defined in
-[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/effect.ts#L35)
+[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/effect.ts#L35)
___
@@ -65,4 +65,4 @@ ___
#### Defined in
-[util.ts:13](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/util.ts#L13)
+[util.ts:13](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/util.ts#L13)
diff --git a/docs/interfaces/util.IdK.md b/docs/interfaces/util.IdK.md
index 35bcab6..361cbc0 100644
--- a/docs/interfaces/util.IdK.md
+++ b/docs/interfaces/util.IdK.md
@@ -45,7 +45,7 @@ type result = ApplyK<SomeFunc, 200>
#### Defined in
-[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/effect.ts#L35)
+[effect.ts:35](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/effect.ts#L35)
___
@@ -59,4 +59,4 @@ ___
#### Defined in
-[util.ts:9](https://github.com/phenax/ts-types-runtime-environment/blob/78e384c/stdlib/util.ts#L9)
+[util.ts:9](https://github.com/phenax/ts-types-runtime-environment/blob/e75a5a1/stdlib/util.ts#L9)