如何实现两次功能(执行两次其他功能的功能)?无法将类型 Record 与类型 Function Int 匹配

How to implement twice function (function that executes other function twice)? Could not match type Record with type Function Int

这是代码

module Main where

import Prelude

twice1 f = f . f

transform :: Int -> Int
transform n = n + 1

apply1 x = (twice1 transform) x

我有一个错误

  Could not match type

    Record

  with type

    Function Int

怎么了? (你可以在这里尝试代码http://try.purescript.org

PureScript 使用点 . 访问记录字段,如:

r = { a: 42, b: "what?!" }
fourtyTwo = r.a

PureScript中的函数组合运算符为<<<(或>>>用于从左到右组合),例如:

twice1 f = f <<< f