Slang Ts

0 views

Problem

Functional programming libraries for TypeScript, like Effect and Ramda, felt too complicated to learn or to teach a team.

Core Idea

An opinionated functional programming library with utilities brought over from Rust and Erlang, each built from scratch.

Guarantees

Zero dependencies. Failures are returned as Ok or Err instead of being thrown.

Tradeoffs

Some functions are not pure, and a few rules are bent for practicality, so it is not a strict functional toolkit. It is opinionated, so teams with different habits may want to adapt it.

typescriptfunctional-programminglibraryopen-source

Overview#

Slang Ts is an opinionated functional programming library for TypeScript. It is published on npm as slang-ts, and it brings utilities over from languages like Rust and Erlang.

Why I Made It#

I love functional programming, and I prefer functions and composition over classes and inheritance. The main reason I made this was simpler. The libraries I found felt too complicated, and they demanded a lot of background knowledge before you could be productive.

I wanted something I could work with comfortably, something I could teach a team in an evening, one utility at a time.

How It Works#

Instead of throwing, a function that can fail returns a Result. An Ok holds the value and an Err holds a message. The caller checks isOk before reading either one.

I aimed for practicality over correctness. Some functions are not pure, and a few rules are broken on purpose. That is what makes it fun to use.

Installation#

Install it with npm i slang-ts, then import only the utilities you use.