/Typex

Functional programming for TypeScript (draft project)

Primary LanguageTypeScriptMIT LicenseMIT

Typex

This repository aims to be a TypeScript port of 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.

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 as documentation.