我在玩 Repa,下面的代码可以编译运行。
import qualified Data.Array.Repa as R
--t:: R.Array R.U (R.Z R.:. Int) Float
--t = R.fromListUnboxed (R.Z R.:. (10::Int)) ([1.0..10]::[Float])
main = do
let x = R.fromListUnboxed (R.Z R.:. (10::Int)) ([1.0..10]::[Float])
print x
我相信(通过检查 ghci)x 具有我声明 t 具有的类型签名,但是如果我取消注释与 t 相关的所有内容,我会收到此错误:
Illegal operator ‘R.:.’ in type ‘R.Z R.:. Int’
Use TypeOperators to allow operators in types
解决在类型声明中使用类型运算符/构造函数的正确方法是什么?(我会谷歌更多,但无论如何也想问一下了解更多)