aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-14 10:37:51 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-14 10:43:20 +0530
commitefe0ab336144d2d965bf355db02762f5cf539c7f (patch)
tree5447c661ffed03e833d7283d3b174bb22fdd2e7a /examples
parent2979eda13e25725683aa10292b31f22793c4e0c0 (diff)
downloadts-types-lang-efe0ab336144d2d965bf355db02762f5cf539c7f.tar.gz
ts-types-lang-efe0ab336144d2d965bf355db02762f5cf539c7f.zip
feat: adds func to try/catch
Diffstat (limited to 'examples')
-rw-r--r--examples/file.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/file.ts b/examples/file.ts
index 2cc2b7a..5af04da 100644
--- a/examples/file.ts
+++ b/examples/file.ts
@@ -7,11 +7,12 @@ interface PrintK extends Kind1<string> {
return: PutStringLn<this['input']>
}
-interface ConstK<Val> extends Kind1<unknown, Val> {
- return: Val
-}
-
export type main = [
- Bind<ReadFile<'./default.nix'>, PrintK>,
- Bind<Try<ReadFile<'./unicorn'>, ConstK<'hello world'>>, PrintK>
+ Bind<ReadFile<'./default.nix'>, <contents extends string>() =>
+ PutStringLn<contents>>,
+
+ Try<
+ Bind<ReadFile<'./unicorn'>, PrintK>,
+ <M extends string>() => PutStringLn<`ERROR: ${M}`>
+ >
]