[英]GHC can't infer unlifted kind
我正在遇到看起来像Happy生成的无效代码。 问题归结为GHC没有推断函数的多金属类型签名。 这是一个例子:
{-# Language MagicHash #-}
f x = ()
main = pure (f 1#)
由于GHC推断f :: a -> ()
,其中a :: *
,因此失败
• Couldn't match a lifted type with an unlifted type
When matching the kind of ‘GHC.Prim.Int#’
• In the first argument of ‘f’, namely ‘1#’
In the first argument of ‘pure’, namely ‘(f 1#)’
In the expression: pure (f 1#)
是否有任何语言编译指示我可以打开以获取此代码进行编译? 我知道理论上我只能添加类型签名,但是,这是由Happy生成的代码,我不想手动修改任何东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.