mezzanine
Version:
Fantasy land union types with pattern matching
44 lines (30 loc) • 2.72 kB
JavaScript
;Object.defineProperty(exports, "__esModule", { value: true });exports.typeContainer = undefined;
var _typeContainer = require('./type-container');var _typeContainer2 = _interopRequireDefault(_typeContainer);
var _decorators = require('../decorators');
require('./index.h');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
/**
* Make single type which
* implements `fantasy-land` spec:
* - Semigroup
* - Setoid
* - Functor
* - Apply
* - Applicative
* - Chain
* - Monad
* - Extend
* - Comonad
*
* @example
* Type`User`({ id: Number, name: String })
*/
function Type(tag, ...restOfName) {
var typeName = typeof tag === 'string' ?
tag :
(0, _decorators.mergeTemplateArgs)(tag, ...restOfName).join('');
return (desc, func = {}) =>
(0, _typeContainer2.default)(typeName, typeName, desc, func);
}exports.
typeContainer = _typeContainer2.default;exports.default =
Type;
//# sourceMappingURL=index.js.map