UNPKG

crocks

Version:

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

24 lines (18 loc) 655 B
/** @license ISC License (c) copyright 2017 original and current authors */ /** @author Ian Hofmann-Hicks (evil) */ var isSameType = require('./isSameType') var isSemigroup = require('./isSemigroup') function innerConcat(method, m) { return function(left) { if(!isSemigroup(left)) { throw new TypeError((method + ": Both containers must contain Semigroups of the same type")) } return m.map(function (right) { if(!isSameType(left, right)) { throw new TypeError((method + ": Both containers must contain Semigroups of the same type")) } return left.concat(right) }) } } module.exports = innerConcat