我正在尝试Data.Vector.Fixed
用作函数的输入,并且正在努力在类型签名中指定向量的维度。
例如,我正在尝试执行以下操作:
acronym :: Vector (Peano 8) String -> String
acronym = foldl1 (++)
并因此使用定义的 peano 数指定向量的维度 (8) Data.Vector.Fixed.Cont
。
但是,尝试编译它会产生类型不匹配错误:
...:12: error:
* Expected a type, but
`Vector (Peano 8) String' has kind
`Constraint'
* In the type signature:
acronym :: Vector (Peano 8) String -> String
|
61 | acronym :: Vector (Peano 8) String -> String
| ^^^^^^^^^^^^^^^^^^^^^^^
...:20: error:
* Expected kind `* -> *', but `Peano 8' has kind `PeanoNum'
* In the first argument of `Vector', namely `(Peano 8)'
In the type signature: acronym :: Vector (Peano 8) String -> String
|
61 | acronym :: Vector (Peano 8) String -> String
如何在类型签名中指定固定向量的大小?