UNPKG

mezzanine

Version:

Fantasy land union types with pattern matching

44 lines (29 loc) 973 B
import typeContainer from './type-container'; import { mergeTemplateArgs } from '../decorators'; import './index.h'; /** * 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 : mergeTemplateArgs(tag, ...restOfName).join(''); return (desc, func = {}) => typeContainer(typeName, typeName, desc, func); } export { typeContainer }; export default Type; //# sourceMappingURL=index.js.map