haskell - 组合任一类型变量
问题描述
我在 Haskell 中有一个函数,它的返回类型是Either error b
,并且有“ function x = Right b1
”和“function (x:xs) b =
我想得到类似的东西Right [list of b's]
。我真的不知道如何解释,我是 Haskell 的新手。我试过了:function (x:xs) = function x <$> function xs
并且
function (x:xs) b = function x b <*> function xs b
,但我得到类型不匹配错误。我唯一想要的是得到 not [Right b1, Right b2, ...]
but, Right [b1, b2, b3]
.
解决方案
推荐阅读
- azure - Azure Logic App 在 Http 查询参数请求中使用 SAS 令牌
- powershell - 在 PowerShell 多行脚本块中传递凭据
- javascript - 未捕获的类型错误:“#myForm”.submit 不是函数
- docker - 构建 docker 映像时出现 Docker COPY 问题
- unity3d - 如何使用八叉树找到 3d 点交点?
- c# - C#:为什么在任务已经完成的情况下获得任务 t.Result 需要这么长时间?
- django - 单击以查看模型时,如何在 Django 管理页面上更新模型?
- tfs - TFS Build 2015“拒绝访问路径”
- java - 如何在 Spring Boot 中聚合健康指标
- javascript - 事件仅在我点击同一个标签时触发