How to use fantasy-helpers - 10 common examples

To help you get started, we’ve selected a few fantasy-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fantasyland / fantasy-birds / src / bluebird.js View on Github external
const combinators = require('fantasy-combinators');
const curry = require('fantasy-helpers').curry


//# bluebird :: (b -> c) -> (a -> b) -> a -> c
//.
//. B combinator or function composition
//.
//. ```js
//. > bluebird(x => x * 2)(x => x - 1)(3)
//. 4
//. ```
const bluebird = curry(combinators.compose)

module.exports = bluebird
github fantasyland / fantasy-birds / src / cardinal_.js View on Github external
const curry = require('fantasy-helpers').curry


//# cardinal_ :: (c -> a -> d) -> (b -> c) -> a -> b -> d
//.
//. C' combinator
//.
//. ```js
//. > cardinal_(x => y => x * y)(x => x + 1)(2)(3)
//. 8
//. ```
const cardinal_ = curry((f, g, x, y) => f(g(y))(x))

module.exports = cardinal_
github fantasyland / fantasy-birds / src / becard.js View on Github external
const curry = require('fantasy-helpers').curry


//# becard :: (c -> d) -> (b -> c) -> (a -> b) -> a -> d
//.
//. B3 combinator or function composition (for three functions)
//.
//. ```js
//. > becard(x => x * -1)(x => x * 2)(x => x - 1)(3)
//. -4
//. ```
const becard = curry((f, g, h, x) => f(g(h(x))))

module.exports = becard
github fantasyland / fantasy-birds / src / robinstarstar.js View on Github external
const curry = require('fantasy-helpers').curry


//# robinstarstar :: (a -> c -> d -> b -> e) -> a -> b -> c -> d -> e
//.
const robinstarstar = curry((f, s, t, u, v) => f(s)(u)(v)(t))

module.exports = robinstarstar
github fantasyland / fantasy-birds / src / idstarstar.js View on Github external
const curry = require('fantasy-helpers').curry


//# idstarstar :: (a -> b -> c) -> a -> b -> c
//.
const idstarstar = curry((f, x, y) => f(x)(y))

module.exports = idstarstar
github fantasyland / fantasy-lenses / src / setter.js View on Github external
'use strict';

const { constant } = require('fantasy-combinators');
const { curry } = require('fantasy-helpers');

const over = curry((l, f, s) => l(f)(s)); 

const set = curry((l, b, s) => over(l, constant(b), s));

const map = curry((f, x) => x.map(f));

module.exports = { over
                 , set: set
                 , map
                 };
github fantasyland / fantasy-lenses / src / setter.js View on Github external
'use strict';

const { constant } = require('fantasy-combinators');
const { curry } = require('fantasy-helpers');

const over = curry((l, f, s) => l(f)(s)); 

const set = curry((l, b, s) => over(l, constant(b), s));

const map = curry((f, x) => x.map(f));

module.exports = { over
                 , set: set
                 , map
                 };
github fantasyland / fantasy-lenses / src / setter.js View on Github external
'use strict';

const { constant } = require('fantasy-combinators');
const { curry } = require('fantasy-helpers');

const over = curry((l, f, s) => l(f)(s)); 

const set = curry((l, b, s) => over(l, constant(b), s));

const map = curry((f, x) => x.map(f));

module.exports = { over
                 , set: set
                 , map
                 };
github fantasyland / fantasy-birds / src / thrush.js View on Github external
const combinators = require('fantasy-combinators');
const curry = require('fantasy-helpers').curry


//# thrush :: a -> (a -> b) -> b
//.
const thrush = curry(combinators.thrush)

module.exports = thrush
github fantasyland / fantasy-birds / src / eagle.js View on Github external
const curry = require('fantasy-helpers').curry


//# eagle :: (a -> d -> e) -> a -> (b -> c -> d) -> b -> c -> e
//.
//. E combinator
//.
//. ```js
//. > eagle(prefix => str => prefix + str)('-')(str => postfix => str + postfix)('birds')('!')
//. '-birds!'
//. ```
const eagle = curry((f, x, g, y, z) => f(x)(g(y)(z)))

module.exports = eagle

fantasy-helpers

Helpers library for Fantasy Land

MIT
Latest version published 11 years ago

Package Health Score

42 / 100
Full package analysis

Popular fantasy-helpers functions

Similar packages