You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/Lib.chs:26:21: error:
• Couldn't match type ‘Color’ with ‘()’
Expected type: C2HSImp.Ptr ()
Actual type: C2HSImp.Ptr Color
• In the first argument of ‘clearBackground'_’, namely ‘a1'’
In the first argument of ‘(>>)’, namely ‘clearBackground'_ a1'’
In the expression: clearBackground'_ a1' >> return ()
The problem is that the generated C wrapper accepts a Color * (a Color pointer), but the "foreign import" tells Haskell that it accepts a Ptr (). It should be Ptr Color instead of Ptr () I believe, something like:
I have the following code in
Lib.chs
:During the build
Lib.chs.c
is generated by C2HS and contains:And
Lib.hs
is also generated by C2HS and contains, in part:Which results in the following type error:
The problem is that the generated C wrapper accepts a
Color *
(a Color pointer), but the "foreign import" tells Haskell that it accepts aPtr ()
. It should bePtr Color
instead ofPtr ()
I believe, something like:A full (yet minimal) demo can be checked out from a repo I created: https://github.com/DevJac/c2hs-bug-demo
C2HS version:
I'm using Cabal 3.0 and GHC 8.6.5.
The text was updated successfully, but these errors were encountered: