// @flow import type { HKT2 } from './HKT' import type { Semigroupoid } from './Semigroupoid' import type { Monoid } from './Monoid' export interface Category extends Semigroupoid { id(): HKT2 } // the set of arrows from A to B export type Hom = HKT2; // the set of arrows from A to A export type Endo = HKT2; // for any object A in any category C, the set of arrows from A to A // is a monoid under the composition operation of C export function getMonoid(category: Category): Monoid> { return { empty(): Endo { return category.id() }, concat(x: Endo, y: Endo): Endo { return category.compose(x, y) } } }