我试图用类型(Floating a) => a -> a -> a的函数组成一个类型的函数(Floating a) => a -> a来获得类型的函数(Floating a) => a -> a -> a.我有以下代码:
test1 :: (Floating a) => a -> a -> a
test1 x y = x
test2 :: (Floating a) => a -> a
test2 x = x
testBoth :: (Floating a) => a -> a -> a
testBoth = test2 . test1
--testBoth x y = test2 (test1 x y)
Run Code Online (Sandbox Code Playgroud)
但是,当我在GHCI中编译它时,我收到以下错误:
/path/test.hs:8:11:
Could not …Run Code Online (Sandbox Code Playgroud)