import { Monoid , MonoidConstructor } from "../monoid" ; import { compose } from "../utils" ; export default class Endo < A > implements Monoid < Endo < A > > { constructor ( public fn ) { } static identity ( ) { return endoId ; } identity ( ) { return endoId ; } combine ( e ) { return new Endo ( compose ( this . fn , e . fn ) ) ; } static create < A > ( f ) { return new Endo ( f ) ; } static toFunction < A > ( e ) { return e . fn ; } } const endoId = new Endo ( x => x ) ;