import { functor } from "./functor" ; import { Monad , monad } from "./monad" ; import { AbstractApplicative } from "./applicative" ; @ monad export default class Identity < A > implements Monad < A > { constructor ( private val ) { } static of < A > ( a ) { return new Identity ( a ) ; } of < A > ( a ) { return new Identity ( a ) ; } ap < B > ( f ) { return new Identity ( f . val ( this . val ) ) ; } extract ( ) { return this . val ; } map < B > ( f ) { return new Identity ( f ( this . val ) ) ; } mapTo < B > ( b ) { return this . of ( b ) ; } flatten ( ) { return this . val as any ; } chain < B > ( f ) { return f ( this . val ) ; } multi = false ; static multi = false ; lift : ( f : Function , ... ms : any [ ] ) => Identity < any > ; }