UNPKG

@dillonkearns/elm-graphql

Version:

<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">

29 lines (19 loc) 619 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.foldMap = foldMap; var _HKT = require('./HKT'); /* A default implementation of `foldMap` using `foldl`. */ /* `Foldable` represents data structures which can be _folded_. - `foldr` folds a structure from the right (not implemented) - `foldl` folds a structure from the left - `foldMap` folds a structure by accumulating values in a `Monoid` reduce = foldl */ function foldMap(foldable, monoid, f, fa) { return foldable.reduce(function (acc, x) { return monoid.concat(f(x), acc); }, monoid.empty(), fa); }