aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-14 11:26:56 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-14 11:26:56 +0530
commit97817711d3eebaacc354a77aa83bc9544cc87d42 (patch)
tree887da757f2890357878c8ec2d21753efaf17a6f2 /examples
parentefe0ab336144d2d965bf355db02762f5cf539c7f (diff)
downloadts-types-lang-97817711d3eebaacc354a77aa83bc9544cc87d42.tar.gz
ts-types-lang-97817711d3eebaacc354a77aa83bc9544cc87d42.zip
feat: adds bindto with scopes
Diffstat (limited to 'examples')
-rw-r--r--examples/file.ts19
1 files changed, 16 insertions, 3 deletions
diff --git a/examples/file.ts b/examples/file.ts
index 5af04da..fb38613 100644
--- a/examples/file.ts
+++ b/examples/file.ts
@@ -1,4 +1,4 @@
-import { Bind, Kind1 } from '../stdlib/effect'
+import { Bind, BindTo, Do, Kind1, Label } from '../stdlib/effect'
import { PutStringLn } from '../stdlib/stdio'
import { ReadFile } from '../stdlib/fs'
import { Try } from '../stdlib/exception'
@@ -8,8 +8,21 @@ interface PrintK extends Kind1<string> {
}
export type main = [
- Bind<ReadFile<'./default.nix'>, <contents extends string>() =>
- PutStringLn<contents>>,
+ Do<[
+ BindTo<"contents", ReadFile<'./bin.js'>>,
+ PutStringLn<"------">,
+ Bind<Label<"contents">, <c extends string>() => PutStringLn<c>>,
+ ]>,
+
+ Try<Bind<Label<"contents">, PrintK>, <e extends string>() =>
+ PutStringLn<`ERROR: ${e}`>>,
+
+ PutStringLn<"-------------">,
+
+ Bind<ReadFile<'./default.nix'>, <c extends string>() =>
+ PutStringLn<c>>,
+
+ PutStringLn<"-------------">,
Try<
Bind<ReadFile<'./unicorn'>, PrintK>,