module type Basic =sig
..end
type 'a
t
val return : 'a -> 'a t
val apply : ('a -> 'b) t ->
'a t -> 'b t
return Fn.id <*> t = t
return Fn.compose <*> tf <*> tg <*> tx = tf <*> (tg <*> tx)
return f <*> return x = return (f x)
tf <*> return x = return (fun f -> f x) <*> tf
val map : [ `Custom of
'a t ->
f:('a -> 'b) -> 'b t
| `Define_using_apply ]
map
argument to Applicative.Make
says how to implement the applicative's
map
function. `Define_using_apply
means to define map t ~f = return f <*> t
.
`Custom
overrides the default implementation, presumably with something more
efficient.
Some other functions returned by Applicative.Make
are defined in terms of map
,
so passing in a more efficient map
will improve their efficiency as well.