这对计算工作流程是正确的建议吗?

问题描述

| 这是来自Expert F#2.0第231页。显然,以下代码块
attempt { let! n1 = failIfBig inp1
let! n2 = failIfBig inp2
let sum = n1 + n2
return sum };;
去糖:
attempt.Bind( failIfBig inp1,(fun n1 ->
attempt.Bind(failIfBig inp2,(fun n2 ->
attempt.Return sum)))))
但是减糖变量中的ѭ2在哪里计算呢?我期望更多这样的东西:
attempt.Bind( failIfBig inp1,(fun n2 -> let sum = n1 +  n2 in
attempt.Return sum)))))
    

解决方法

        是的,这是本书中的错误,应按以下说明取消使用:
attempt.Bind( failIfBig inp1,(fun n1 ->
attempt.Bind(failIfBig inp2,(fun n2 -> let sum = n1 +  n2 in
attempt.Return sum)))))
    

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...