UNPKG

crocks

Version:

A collection of well known Algebraic Datatypes for your utter enjoyment.

20 lines (15 loc) 526 B
/** @license ISC License (c) copyright 2016 original and current authors */ /** @author Ian Hofmann-Hicks (evil) */ var curry = require('../core/curry') var isFunction = require('../core/isFunction') // Substitution (Starling) // substitution : (a -> b -> c) -> (a -> b) -> a -> c function substitution(f, g, x) { if(!(isFunction(f) && isFunction(g))) { throw new TypeError( 'substitution: Functions required for first two arguments' ) } return curry(f)(x, g(x)) } module.exports = curry(substitution)