This is from Expert F # 2.0, page 231. Apparently, the following block of code
attempt { let! n1 = failIfBig inp1
let! n2 = failIfBig inp2
let sum = n1 + n2
return sum };;
de-sugars to this:
attempt.Bind( failIfBig inp1,(fun n1 ->
attempt.Bind(failIfBig inp2,(fun n2 ->
attempt.Return sum)))))
but where sum, calculated in the de-sagar version? I was expecting something more:
attempt.Bind( failIfBig inp1,(fun n1 ->
attempt.Bind(failIfBig inp2,(fun n2 -> let sum = n1 + n2 in
attempt.Return sum)))))
source
share