{"size": 546, "ext": "js", "max_stars_repo_path": "src/pointfree/alt.js", "max_stars_repo_name": "amite/crocks", "max_stars_repo_stars_event_min_datetime": "2020-05-12T18:39:41.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-12T18:39:41.000Z", "max_issues_repo_path": "src/pointfree/alt.js", "max_issues_repo_name": "narley/crocks", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/pointfree/alt.js", "max_forks_repo_name": "narley/crocks", "max_forks_repo_forks_event_min_datetime": "2019-03-21T17:33:50.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-21T17:33:50.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 26.0, "max_line_length": 75, "alphanum_fraction": 0.6208791209}
/** @license ISC License (c) copyright 2017 original and current authors */
/** @author Ian Hofmann-Hicks (evil) */

const curry = require('../core/curry')
const fl = require('../core/flNames')
const isAlt = require('../core/isAlt')
const isSameType = require('../core/isSameType')

// alt : Alt m => m a -> m a -> m a
function alt(m, x) {
  if(!(isAlt(m) && isSameType(m, x))) {
    throw new TypeError(
      'alt: Both arguments must be Alts of the same type'
    )
  }

  return (x[fl.alt] || x.alt).call(x, m)
}

module.exports = curry(alt)
