npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fpjs/overture

v0.7.1

Published

A Javascript prelude

Downloads

45

Readme

Overture

A Javascript library that provides the very basics for functional programming.

Overture aims to be fully compatible with the Fantasy Land Specification, but does not yet implement the complete specification.

Getting Started

The simplest way to explore is by using the repl that comes with @fpjs/overture.

> npx --package='@fpjs/overture' -c repl

This puts you in a repl with all overture modules globally available.

Upgrading

A changelog is kept in RELEASES.md, which lists the major changes.

Usage

Overture provides multiple modules to allow you to import just the ones you actually use. All imports are relative to the package root @fpjs/overture.

import {id} from "@fpjs/overture/base";

Algebras

Algebras are implemented in @fpjs/overture/algebras. Each algebra exports its related functions, causing some functions being exported by multiple algebras (e.g. ap, which is exported by Apply and Applicative).

Data structures

Some common data structures such as Identity and Maybe are implemented in @fpjs/overture/data.

Callback functor

Node.js-style callback functions are notoriously cumbersome to deal with. The Callback functor (@fpjs/overture/control/callback) wraps callback-style functions and provides Functor, Applicative and Monad instances. This allows to simply deal with the data in a callback.

Lens

Lenses ease (nested) record attribute access. An implemention is provides in @fpjs/overture/control/lens.

Built-ins

To use the implementations of various algebras for built-ins (like Array and Promise), the built-in classes can be extended (or: monkey patched). This is always opt-in; no modules have side effects just on importing them.

import {patchBuiltins} from "@fpjs/overture/patches";
...
patchBuiltins();

Fantasy Land compatibility

Algebras

  • [X] Setoid
  • [X] Ord
  • [ ] Semigroupoid
  • [ ] Category
  • [X] Semigroup
  • [X] Monoid
  • [ ] Group
  • [ ] Filterable
  • [X] Functor
  • [ ] Contravariant
  • [X] Apply
  • [X] Applicative
  • [ ] Alt
  • [ ] Plus
  • [ ] Alternative
  • [X] Foldable
  • [X] Traversable
  • [X] Chain
  • [ ] ChainRec
  • [X] Monad
  • [ ] Extend
  • [ ] Comonad
  • [ ] Bifunctor
  • [ ] Profunctor

Derivations

  • [X] derive fantasy-land/equals for Ord
  • [ ] derive fantasy-land/map for Applicative
  • [ ] derive fantasy-land/map for Monad
  • [ ] derive fantasy-land/map for Bifunctor
  • [ ] derive fantasy-land/ap for Chain

License

Copyright 2019-2023, Bart Bakker.

This software is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.