scala - 函数组合导致方法首先缺少参数列表
问题描述
假设我们有以下函数:
def first(a: A): B = ???
def second(b: B): C = ???
我想用 来组合它们andThen
,但是下面的代码:
(first andThen second)(a)
结果是:
<console>:14: error: missing argument list for method first
Unapplied methods are only converted to functions when a function type is expected.
You can make this conversion explicit by writing `first _` or `first(_)` instead of `first`.
(first andThen second) (1)
解决方案
推荐阅读
- python - 将 .fit 更改为 .fits 文件
- ios - 找不到 -lPods-项目名称的 iibrary
- css - 位置:绝对菜单卡在主体顶部,不在视口中
- python - 如何读取一次excel文件并持久保存结果
- node.js - 您可以传递 TypeORM 驱动程序级别的参数或为 TypeORM 提供预先创建的连接/池吗?
- reactjs - AWS AppSync GraphQL 我如何真正删除记录,而不仅仅是将“true”添加到 _deleted 列?
- sql - BizTalk WCF-SQL Insert 是否支持“NEXT VALUE FOR”(序列)
- excel - 弹出错误消息时关闭 Excel 文件
- flutter - 为什么我的flushbar在运行方法后不显示?
- flutter - 我该如何解决在 null 上调用了 getter 'length'。接收者:null 尝试调用:长度?