https://github.com/gsscoder/typex
Functional programming for TypeScript (draft project)
https://github.com/gsscoder/typex
Last synced: 4 months ago
JSON representation
Functional programming for TypeScript (draft project)
- Host: GitHub
- URL: https://github.com/gsscoder/typex
- Owner: gsscoder
- License: mit
- Created: 2020-02-28T06:01:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T19:46:22.000Z (over 2 years ago)
- Last Synced: 2024-12-28T15:33:56.948Z (6 months ago)
- Language: TypeScript
- Size: 210 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Typex
This repository aims to be a **TypeScript** port of [CSharpx](https://github.com/gsscoder/csharpx), a functional programming library for **C#**.
I've started it both as a learning experience and for use in production projects.
## Maybe type
For now `Maybe` is the only type implemented. It is an option type, essentially **Haskell** `Data.Maybe`.
```ts
import * as maybe from 'maybe'let maybes = [maybe.nothing, maybe.just(0), maybe.nothing, maybe.just(1)]
let outcome = maybe.catMaybes(maybes)
// outcome: [0, 1]
```See [tests](https://github.com/gsscoder/Typex/blob/master/tests/maybeSpecs.ts) as documentation.