From 97817711d3eebaacc354a77aa83bc9544cc87d42 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Jan 2023 11:26:56 +0530 Subject: feat: adds bindto with scopes --- examples/file.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'examples') 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 { } export type main = [ - Bind, () => - PutStringLn>, + Do<[ + BindTo<"contents", ReadFile<'./bin.js'>>, + PutStringLn<"------">, + Bind, () => PutStringLn>, + ]>, + + Try, PrintK>, () => + PutStringLn<`ERROR: ${e}`>>, + + PutStringLn<"-------------">, + + Bind, () => + PutStringLn>, + + PutStringLn<"-------------">, Try< Bind, PrintK>, -- cgit v1.3.1