blob: 4eb81042acf59c68d13aaa93f0f057d6520c6679 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# KaiScript
#### KaiScript is a simple functional programming language implemented inside of the TypeScript type system and inside of the TypeScript language.
This means that you can write programs inside TypeScript that evaluate without running the code. The inferred type of a KaiScript program is always exactly equal to the runtime value.

## Using KaiScript
To see what KaiScript is capable of, take a look at the guided tour here: [[EXAMPLES]](./examples/README.md)
## Links
- [GitHub repository](https://github.com/KaiStevenson/kai-script)
- [Self hosted repository](https://git.aberrantflux.xyz/kai-script.git/)
- [NPM package](https://www.npmjs.com/package/@aberrantflux/kai-script)
## FAQ
> Why would I want to use this?
You probably wouldn't!
> Why did you make this?
TypeScript has a fantastic type system that is somewhat underappreciated in the public consciousness. Writing this was super fun, and I discovered a lot along the way. You should do it too! If you're interested in trying, I recommend not looking at the implementation of KaiScript. **Most of the fun is in figuring it out for yourself**.
> How can I write imperative code?
You can't.
> How can I publish a package for KaiScript?
KaiScript doesn't have its own package manager yet, but it works natively with npm.
If you've written a useful library, just export it like so:
```typescript
export const myKaiScriptFunction = "fn(...)";
```
Publish it to npm, and anyone else can easily use it via template literals:
```typescript
import { myKaiScriptFunction } from "my-kai-script-function";
export const usesLibrary = `call(${myKaiScriptFunction}, args)`;
```
|