these指令执行qmake和mingw32-make成功后,
我执行runhaskell Setup.hs build,出现以下错误:

[651 of 662] Compiling Qtc.Core.Attributes ( Qtc\Core\Attributes.hs, dist\build\Qtc\Core\Attributes.o )
Qtc\Core\Attributes.hs:584:13:
Could not deduce (Qstt a (QDialogSc b))
  arising from a use of `slotReject''
from the context (Qstt a (QDialogSc b1))
  bound by the instance declaration
  at Qtc\Core\Attributes.hs:582:10-52
Possible fix:
  add (Qstt a (QDialogSc b)) to the context of
    the instance declaration
  or add an instance declaration for (Qstt a (QDialogSc b))
In the expression: slotReject'
In an equation for `reject'': reject' = slotReject'
In the instance declaration for `QsaSlotReject a'

Attributes.hs文件(第578-583行):
class QsaSlotReject w where
  slotReject', reject' ::  (Qslot w (w -> ()), (w -> ()))

instance (Qstt a (QDialogSc b)) => QsaSlotReject (a) where
  slotReject' = (Qslot "reject()", \_ -> ())
  reject' = slotReject'

环境:
  • Windows 7
  • Haskell平台2011.2.0
  • Qt sdk 4.7

  • 顺便说一句,我在此过程中两次遇到内存不足的问题,但我想那没关系。

    最佳答案

    麻烦来自这样一个事实:

    data Qslot x f = Qslot String
    

    因此从Qslot“Blah blah”形式的给定项中推断出x和f可能会有些困难。自从去年秋天qthaskell的最新版本发布以来,GHC使用的推理机制可能发生了细微的变化。

    无论如何,它似乎可以编译,并带有一些奇怪的警告,并且如果替换掉这些示例,这些示例也可以工作
     instance (Qstt a (QDialogSc b)) => QsaSlotReject (a) where
        slotReject' = (Qslot "reject()", \_ -> ())
        reject' = slotReject'
    


     instance (Qstt a (QDialogSc b)) => QsaSlotReject (a) where
       slotReject' = (Qslot "reject()", \_ -> ())
       reject' = (Qslot "reject()", \_ -> ())
    

    这样ghc不必想那么多...

    必须有一些东西可以使事情变得更加精确。我不知道是否在稍后逐渐开始出现的eta减少警告与这条线有关。

    关于windows - 编译qtHaskell时发生错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5290479/

    10-11 13:06
    查看更多