Introduction_to_Haskell_2ed_source
Introduction_to_Haskell_2ed_source copied to clipboard
【 C16 TypeComputation2】咨询一下,为什么在新版本的 GHC 中无法在类型家族中定义乘法
代码:
type family (n :: Nat) * (m :: Nat) :: Nat where
Z * m = Z
S n * m = (n * m) + m
HLS 报错:parser: Malformed head of type or class declaration: (n :: Nat) (*) (m :: Nat)
这一段代码在 GHC 8.0.4是可以编译通过的,但最新版本的GHC无法通过。😭搜了一下没找到有关资料,实在是好奇,所以来问一下。
有人能看到吗?看到的话能吱一声吗?😭