typology
所属分类:其他
开发工具:TypeScript
文件大小:0KB
下载次数:0
上传日期:2023-07-19 15:59:27
上 传 者:
sh-1993
说明: 探索类型级别编程的游乐场。,
(Playground for exploring type-level programming.,)
文件列表:
.eslintrc.js (284, 2023-10-17)
.prettierrc.json (46, 2023-10-17)
LICENSE (35149, 2023-10-17)
jest.config.js (69, 2023-10-17)
package-lock.json (482539, 2023-10-17)
package.json (709, 2023-10-17)
src/ (0, 2023-10-17)
src/Arithmetic.ts (852, 2023-10-17)
src/Bool.ts (84, 2023-10-17)
src/Conditionals.ts (1296, 2023-10-17)
src/Math.ts (163, 2023-10-17)
src/Nat.ts (858, 2023-10-17)
src/Parse.ts (408, 2023-10-17)
src/String.ts (1149, 2023-10-17)
src/__tests__/ (0, 2023-10-17)
src/__tests__/Arithmetic.ts (5119, 2023-10-17)
src/__tests__/Bool.ts (296, 2023-10-17)
src/__tests__/Conditionals.ts (6904, 2023-10-17)
src/__tests__/Math.ts (1015, 2023-10-17)
src/__tests__/Nat.ts (1033, 2023-10-17)
src/__tests__/Parse.ts (2109, 2023-10-17)
src/__tests__/String.ts (3934, 2023-10-17)
src/__tests__/algorithms/ (0, 2023-10-17)
src/__tests__/algorithms/Factorial.ts (1848, 2023-10-17)
src/__tests__/algorithms/Fibonacci.ts (3035, 2023-10-17)
src/algorithms/ (0, 2023-10-17)
src/algorithms/Factorial.ts (307, 2023-10-17)
src/algorithms/Fibonacci.ts (326, 2023-10-17)
tsconfig.json (6635, 2023-10-17)
# Typology
![CI](https://github.com/majjoha/typology/workflows/CI/badge.svg)
Typology is a playground for exploring type-level programming in TypeScript. The
various types range from simple representations of natural numbers to types that
can compute Fibonacci numbers.
## Examples
### Addition
```typescript
const three: Add, Succ>> = {
n: {
n: {
n: "zero"
},
},
}
```
### Factorial
```typescript
const six: Factorial = { n: { n: { n: { n: { n: { n: "zero" } } } } } }
```
### Convert strings to numbers
```typescript
const five: FromString<"{ n: { n: { n: { n: { n: zero } } } } }"> = {
n: { n: { n: { n: { n: "zero" } } } },
}
```
### Boolean logic
```typescript
const two: IfElse<
And<
LessThan,
Not>
>,
ToString>>,
never
> = "{ n: { n: zero } }"
```
### Fibonacci numbers
```typescript
const five: Fibonacci = { n: { n: { n: { n: { n: "zero" } } } } }
```
## License
See [LICENSE](./LICENSE).
近期下载者:
相关文件:
收藏者: