UNPKG

crocks

Version:

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

34 lines (27 loc) 856 B
/** @license ISC License (c) copyright 2016 original and current authors */ /** @author Ian Hofmann-Hicks (evil) */ var _mconcatMap = require('../core/mconcatMap') var curry = require('../core/curry') var isFoldable = require('../core/isFoldable') var isFunction = require('../core/isFunction') var isMonoid = require('../core/isMonoid') // mconcatMap : Monoid M => M -> (b -> a) -> ([ b ] | List b) -> M a function mconcatMap(m, f, xs) { if(!isMonoid(m)) { throw new TypeError( 'mconcatMap: Monoid required for first argument' ) } if(!isFunction(f)) { throw new TypeError( 'mconcatMap: Function required for second argument' ) } if(!isFoldable(xs)) { throw new TypeError( 'mconcatMap: Foldable required for third argument' ) } return _mconcatMap(m, f, xs) } module.exports = curry(mconcatMap)