2.1.5 • Published 2 years ago

hkt-ts v2.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

HKT-TS

HKT-TS is an encoding for Higher-Kinded Types (HKT) for TypeScript, with composable Typclasses to describe the majority of functionality you'll be using to write your programs.

It is principled, based primarily in Type Theory and Alegbra, but also with roots in Category Theory.

If you've ever used a compiler for a strictly-typed language like TypeScript before, the annotations you're writing already follow all of these rules, and you likely know more about it already than you may realize. If something is an Algebra, it can be solved, like how your type-checker solves for the correctness of your program.

The laws required to build something like a type-checker are generally applicable to all programming -- this is where HKT-TS comes in. HKT-TS provides the highest level of abstractions possible within TypeScript and will allow you to place composition at the forefront of programs. It will allow you to rapidly compose small solutions into larger solutions with an emphasis on type safety.

Right now there's not a lot to see besides the code itself, but it is my goal to make learning materials accessible on all of the topics above as well as the contents of this library -- check back soon for more.

Acknowledgments

HKT-TS has been greatly influenced by numerous other open-source projects, the biggest being the Scala library ZIO-Prelude which is the pioneer of a brand new way to blend Category Theory with programming languages that aren't Haskell.

Within the TypeScript space, I've been inspired and taken influence from Effect-TS which offers a port of a larger portion of ZIO including ZIO-Prelude. If you're interested in powerful effects that are built upon abstractions like these, with a strong standard library, check them out. Also if you love FP, then check out the amazing things they're doing with TS+ for functional programmers. I look forward to seeing it continue to mature!

Last but certainly not least, I have to give a huge shoutout to fp-ts, another HKT encoding for TypeScript that provides a Haskell-like expression of Category Theory with a rich standard library and ecosystem, which I've been using for a few years now. It's helped me greatly to dive into the world of Category Theory as it is applied to programming, but after seeing this talk during the beginning months of COVID, I've constantly been questioning if it's the easiest approach to learn and teach.

HKT-TS is the culmination of my attempts to learn this new set of TypeClasses and what they're capable of.

Installation

NOTE: For the best experience you'll want to use typescript >= 4.7 to be able to use the NodeNext moduleResolution mode to support the package exports defined for this project. All examples are written in this format. Otherwise hkt-ts/cjs or hkt-ts/esm will be needed to have type-safe imports with TypeScript.

# NPM
npm i --save hkt-ts

# Yarn
yarn add hkt-ts

# PNPM
pnpm add hkt-ts

Related Links

2.1.2

2 years ago

2.0.3

2 years ago

2.1.1

2 years ago

2.0.2

2 years ago

2.1.4

2 years ago

2.0.13

2 years ago

2.0.5

2 years ago

2.1.3

2 years ago

2.0.4

2 years ago

2.0.11

2 years ago

2.0.7

2 years ago

2.1.5

2 years ago

2.0.12

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.5.2

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago