From 92956b4d5c330690f85be95185a1c6ef99094111 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 7 Jan 2023 01:23:30 +0530 Subject: docs: readme --- README.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 901e4ee..8a749a3 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,37 @@ -# TS Types lang -A stupid runtime for TS types! +# TS Types lang [WIP] +A runtime for ts types that turns it into a general purpose pure functional programming language! -Take a look at the [./examples][./examples] directory for examples on how to write a program in typescript types +Take a look at the [./examples](./examples) directory for examples on how to write a program in typescript types + + +### Example + +```typescript +import { PutString, Bind, Kind1, ReadLine, Do } from 'ts-types-lang/stdlib' + +// :: string -> Effect () +interface GreetK extends Kind1 { + return: Do<[ + PutString<"Hello, ">, + PutString<`${this['input']}\n`> + ]>, +} + +// main :: [Effect ()] | Effect () +export type main = [ + PutString<"Your name? ">, + Bind, +] +``` To run it - ```bash -npx ts-types-lang ./examples/guess-number.ts +npx tsr ./examples/guess-number.ts +// OR +yarn exec tsr ./examples/guess-number.ts ``` + ### Why? I dunno -- cgit v1.3.1