gpt4 book ai didi

functional-programming - 你如何在 PureScript 中组合函数?

转载 作者:行者123 更新时间:2023-12-04 07:32:47 25 4
gpt4 key购买 nike

尝试使用 (.)对于函数组合,但它不起作用。

import Data.String (length, trim)

trimmedLength :: String -> Int
trimmedLength = length . trim

最佳答案

PureScript 中的函数组合是通过 (<<<) 完成的,不是 (.) .

import Data.String (length, trim)

trimmedLength :: String -> Int
trimmedLength = length <<< trim

关于functional-programming - 你如何在 PureScript 中组合函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46253149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com