Parameter Make.1-X
val return : 'a -> 'a tval apply : ('a -> 'b) t -> 'a t -> 'b tThe following identities ought to hold for every Applicative (for some value of =):
- identity:
return Fn.id <*> t = t - composition:
return Fn.compose <*> tf <*> tg <*> tx = tf <*> (tg <*> tx) - homomorphism:
return f <*> return x = return (f x) - interchange:
tf <*> return x = return (fun f -> f x) <*> tf
Note: <*> is the infix notation for apply.
- identity:
val map : [ `Define_using_apply | `Custom of 'a t -> f:('a -> 'b) -> 'b t ]The
mapargument toApplicative.Makesays how to implement the applicative'smapfunction.`Define_using_applymeans to definemap t ~f = return f <*> t.`Customoverrides the default implementation, presumably with something more efficient.Some other functions returned by
Applicative.Makeare defined in terms ofmap, so passing in a more efficientmapwill improve their efficiency as well.