此代码:
foreign export ccall rvcb_create_context :: Ptr Spec -> CInt -> CInt -> CInt -> CInt -> CInt -> IO (Ptr Context)
rvcb_create_context specPtr id direction alignment size step = do
spec <- deRefStablePtr $ castPtrToStablePtr $ castPtr specPtr
let wsize = fi size
wstep = fi step
alignment'
| alignment == raava_start = AlignStart
| alignment == raava_end = AlignEnd
direction'
| direction == raava_tostart = ToStart
| direction == raava_toend = ToEnd
window
| id == raava_single = Single
| id == raava_rolling = Rolling alignment' wsize wstep
| id == raava_expanding = Expanding direction' wsize wstep
| otherwise =
error (printf "impossible id %s" (show id))
生成此错误,即使我对其
有什么含糊的概念,我也不知道如何修复121:35: error:
• Couldn't match expected type ‘Window’
with actual type ‘WinStep -> Window’
• Probable cause: ‘Expanding’ is applied to too few arguments
In the expression: Expanding direction' wsize wstep
In an equation for ‘window'’:
window'
| id == raava_single = Single
| id == raava_rolling = Rolling alignment' wsize wstep
| id == raava_expanding = Expanding direction' wsize wstep
| otherwise = error (printf "impossible id %s" (show id))
In the expression:
do spec <- deRefStablePtr $ castPtrToStablePtr $ castPtr specPtr
let wsize = fi size
wstep = fi step
....
let context = genContext spec window
contextPtr <- newStablePtr context
....
|
121 | | id == raava_expanding = Expanding direction' wsize wstep
答案 0 :(得分:1)
你的问题在这里:
| id == raava_expanding = Expanding direction' wsize wstep
编译器说你错过了Expanding
类WinStep
的另一个参数。如果您不放置该参数,则返回类型为WinStep -> Window
的函数,而不是预期类型Window
。