Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phenax/ts-types-runtime
A runtime for typescript's type system that turns it into a general purpose, purely functional programming language with effects!
https://github.com/phenax/ts-types-runtime
effects functional-programming type-level-programming typescript
Last synced: about 6 hours ago
JSON representation
A runtime for typescript's type system that turns it into a general purpose, purely functional programming language with effects!
- Host: GitHub
- URL: https://github.com/phenax/ts-types-runtime
- Owner: phenax
- License: mit
- Created: 2023-01-05T13:26:21.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-15T10:57:21.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T06:21:22.121Z (about 1 month ago)
- Topics: effects, functional-programming, type-level-programming, typescript
- Language: TypeScript
- Homepage:
- Size: 172 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TS Types lang
A runtime for typescript's **type system** that turns it into a **general purpose**, **purely functional** programming language with effects!## Documentation
- [stdlib reference](./docs/modules.md)
- [examples](./examples/)## Implemented effects
* read/write file
* simple stdio interactions
* error handling
* test runner
* mutable references
* js ffi
* get cli args, env vars## Example
Take a look at the [./examples](./examples/) directory for more examples on how to write a program in typescript types
```typescript
import { Bind, Do, Kind1 } from 'ts-types-lang/stdlib/effect'
import { WriteFile } from 'ts-types-lang/stdlib/fs'
import { PutString, ReadLine, PutStringLn } from 'ts-types-lang/stdlib/stdio'export type main = [
PutStringLn<'Greetotron 6000 initializing...'>,
PutStringLn<''>,PutString<'Your name? '>,
Bind() =>
PutStringLn<`Hello, ${name}`>>,PutString<'Your purpose in life? '>,
Bind,PutStringLn<'Bye bye'>,
]// :: string -> Effect ()
interface HandleResponseK extends Kind1 {
return: Do<[
PutStringLn<`Interesting that you believe "${this['input']}" is your purpose. Hmmmm...`>,
PutStringLn<'Judging harshly...'>,
PutStringLn<'Saving response...'>,
WriteFile<'./response.txt', this['input']>,
]>
}
```## Run a types-lang module
Install it -
```bash
npm i --save ts-types-lang
# OR
yarn add ts-types-lang
```Or just run it -
```bash
npx tsr run ./examples/guess-number.ts
# OR
yarn exec tsr run ./examples/guess-number.ts
```## FAQ
#### Why?
Why not?#### How?
Why?#### What?
What?#### Should I use this?
No