Since `dpm`s are to be a monad, we have to define a unit and a bind. These are just modeled on the unit and bind for the state monad:
- let unit_dpm (x : 'a) = fun (r, h) -> (x, r, h);;
+ let unit_dpm (value : 'a) : 'a dpm = fun (r, h) -> (value, r, h);;
- let bind_dpm (u : 'a dpm) (f : 'a -> 'b dpm) =
+ let bind_dpm (u : 'a dpm) (f : 'a -> 'b dpm) : 'b dpm =
fun (r, h) ->
let (a, r', h') = u (r, h)
in let u' = f a