prelude
a base library for functional programming in deno
Roadmap
⚠️ WATCH OUT!
- semver won’t be enforced until v1.0.0
- partial application and other tuple related functions won’t be available until deno supports TypeScript 4.0
Goals
- provide interfaces corresponding to static-land spec type classes and factory functions for implementing its instances
- provide a good replacement for libraries like fp-ts, ramda, hkts and lodash
- provide interfaces for additional purescript based type classes
- provide some basic (primitives, Maybe, Either, etc…) instances for existing type classes
- support and idioms for deno comes first, but browser and node should be compatible
Non-Goals
- break compatibility with static-land
- provide every type class and instance corresponding to haskell/purescript
- requiring abstractions with higher runtime cost than handwritten functional code
Documentation
Is currently a work in progress and not a priority until instances for most primitive types are implemented.
Known limitations
- every kind is limited to a single parameter (but kinds can yield kinds)
- testing kind applications is weird
- a useless expression is required to check type class instances:
(():
& Monoid<Ap<ArrayKind, unknown>>
& Setoid<Ap<ArrayKind, unknown>>
& Semigroup<Ap<ArrayKind, unknown>>
& Group<Ap<ArrayKind, unknown>>
& Functor<ArrayKind>
& Foldable<ArrayKind>
& Filterable<ArrayKind>
& Apply<ArrayKind>
& Applicative<ArrayKind>
& Chain<ArrayKind>
& Monad<ArrayKind> => ({
equals,
empty,
concat,
map,
reduce,
filter,
ap,
of,
chain,
join,
invert,
}));
Related work
For Developers
If you want to contribute to prelude:
- clone this repository
- make sure you have deno installed in your path
- install the
pre-commit
running:
- on linux/unix-likes:
./scripts/hook
from the repository root directory
- on windows with cmder:
sh scripts/hook
from the repository root directory
- run scripts from the repository root directory
Thanks!
Download Details:
Author: kress95
Source Code: https://github.com/kress95/prelude
#deno #nodejs #node #javascript