, :
Cont IMHO
(), a Cont .
Inc,
"" . (
'T), . :
Inc - , .
Inc
.
Bind.
, ,
unit, ,
.
, 'T -> unit, Inc :
type Inc<'T> =
('T -> unit) -> unit
Inc 'T , unit.
Bind. , , :
let bind (inc : Inc<'T>) (wrap : 'T -> Inc<'U>) : Inc<'U> =
, Bind ( 'T) , "" ( 'U) , , , Bind Inc, Inc - , . , Bind :
fun (cont : 'U -> unit) -> ...
- 'T, Inc, -. . - Inc , ! "" . Bind :
let bind (inc : Inc<'T>) (wrap : 'T -> Inc<'U>) : Inc<'U> =
fun (cont : 'U -> unit) -> // return an Inc, which is a function that takes a continuation as input
inc (fun t -> // force the incomplete computation to cough up its wrapped value
(wrap t) cont) // wrap the raw value so it can be sent to the given continuation