UNPKG

crocks

Version:

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

20 lines (15 loc) 546 B
/** @license ISC License (c) copyright 2016 original and current authors */ /** @author Ian Hofmann-Hicks (evil) */ var curry = require('../core/curry') var isSameType = require('../core/isSameType') var isSemigroup = require('../core/isSemigroup') var fl = require('../core/flNames') function concat(x, m) { if(!(isSemigroup(m) && isSameType(x, m))) { throw new TypeError( 'concat: Semigroups of the same type required for both arguments' ) } return (m[fl.concat] || m.concat).call(m, x) } module.exports = curry(concat)