@petrborak/functors
Functors for functional programming
Last updated a month ago by petrborak .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @petrborak/functors 
SYNC missed versions from official npm registry.

npm version Coverage Status Build Status

BASIC FUNCTORS AND HELPER UTILITIES

This package is meant to enable usage of support files from https://www.npmjs.com/package/@mostly-adequate/support for usage in typescript based project of my own.

The main intention is to use the profound Functors in production. That's mostly because hovewer there exits many functional utility packages (like ramda asn.), I have not found similar libraries for Functors and Monads.

Library formats

The library is build into UMD / ecma 5 and Ecma 6 + Harmony modules;

UMD / ecma 5 (AMD + CommonJs)

const { Maybe, liftA2, append, concat, reverse } = require('@petrborak/functors');

const a = Maybe.of("yltsoM").map(reverse);
const b = Maybe.of("Adequate").map(concat(" "));

liftA2(append)(b)(a);
// Just("Mostly Adequate")

Ecma 6 + Harmony modules

import { Maybe, liftA2, append, concat, reverse } from '@petrborak/functors';
import { IO  } from '@petrborak/functors/src/IO';

const a = Maybe.of("yltsoM").map(reverse);
const b = Maybe.of("Adequate").map(concat(" "));

liftA2(append)(b)(a);
// Just("Mostly Adequate")

Types, test coverage

Order makes friends. So to make myself comfortable with the solutions in the support files, I have typed it and I am also recently working on test coverage.

The following is the README from original solution

Mostly Adequate Guide to Functional Programming - Support

Overview

This package contains all functions and data-structure referenced in the appendixes of the Mostly Adequate Guide to Functional Programming.

These functions have an educational purpose and aren't intended to be used in any production environment. They are however, a good learning material for anyone interested in functional programming.

How to install

The package is available on npm and can be installed via the following incantation:

npm install @mostly-adequate/support

How to use

There's no particular structure to the module, everything is flat and exported from the root (the curious reader may have a quick glance at the index.js to get convinced about this).

Also, all top-level functions are curried so you don't have to worry about calling curry on any of them.

For example:

const { Maybe, liftA2, append, concat, reverse } = require('@mostly-adequate/support');

const a = Maybe.of("yltsoM").map(reverse);
const b = Maybe.of("Adequate").map(concat(" "));

liftA2(append)(b)(a);
// Just("Mostly Adequate")

Current Tags

  • 5.0.0-alpha.0                                ...           alpha (2 months ago)
  • 4.0.1-beta.0                                ...           beta (2 months ago)
  • 9.3.0                                ...           latest (a month ago)

40 Versions

  • 9.3.0                                ...           a month ago
  • 9.2.0                                ...           a month ago
  • 9.1.0                                ...           a month ago
  • 9.0.0                                ...           2 months ago
  • 8.5.4                                ...           2 months ago
  • 8.5.3                                ...           2 months ago
  • 8.5.1                                ...           2 months ago
  • 8.5.0                                ...           2 months ago
  • 8.4.2                                ...           2 months ago
  • 8.4.0                                ...           2 months ago
  • 8.3.0                                ...           2 months ago
  • 8.2.0                                ...           2 months ago
  • 8.1.0                                ...           2 months ago
  • 8.0.0                                ...           2 months ago
  • 7.0.1                                ...           2 months ago
  • 7.0.0                                ...           2 months ago
  • 6.10.1                                ...           2 months ago
  • 6.10.0                                ...           2 months ago
  • 6.9.0                                ...           2 months ago
  • 6.8.0                                ...           2 months ago
  • 6.7.0                                ...           2 months ago
  • 6.6.0                                ...           2 months ago
  • 6.5.0                                ...           2 months ago
  • 6.4.0                                ...           2 months ago
  • 6.3.0                                ...           2 months ago
  • 6.1.0                                ...           2 months ago
  • 6.0.0                                ...           2 months ago
  • 5.2.0                                ...           2 months ago
  • 5.1.0                                ...           2 months ago
  • 5.0.1                                ...           2 months ago
  • 5.0.0-alpha.0                                ...           2 months ago
  • 1.0.0-alpha.0                                ...           2 months ago
  • 4.0.2-beta.0                                ...           2 months ago
  • 4.0.1-beta.0                                ...           2 months ago
  • 4.0.0-aplha.3                                ...           2 months ago
  • 4.0.0-alpha.1                                ...           2 months ago
  • 4.0.0-alpha.0                                ...           2 months ago
  • 3.0.0                                ...           2 months ago
  • 2.0.0                                ...           2 months ago
  • 1.0.0                                ...           2 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 421
Dependencies (12)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |