aboutsummaryrefslogtreecommitdiff
path: root/docs/interfaces/effect.BindTo.md
blob: 0775364719ac7f395522d46d5415b474fa852842 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[ts-types-lang](../README.md) / [Modules](../modules.md) / [effect](../modules/effect.md) / BindTo

# Interface: BindTo<_Name, _Eff\>

[effect](../modules/effect.md).BindTo

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
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 name of label |
| `_Eff` | extends [`Effect`](effect.Effect.md) | Effect to evaluate |

## Hierarchy

- [`Effect`](effect.Effect.md)

  ↳ **`BindTo`**