(* FROM: Sato et al. POPL 2019, https://people.mpi-sws.org/~dg/papers/popl19-prob.pdf, Monte Carlo approximation *)let monteCarlo = fun draw => fun h => rec loop i => if i <= 0 then 0 else let m = loop (i - 1) in let x = draw () in (h x + (i - 1) * m) / iin(* h must be affine *)let draw = fun unit => uniform(0, 1) inlet h = fun x => 2 * x + 1 in monteCarlo draw h 10