haskell / haskell/c2hs

In what case would c2hs import Foreign.Ptr?

Open
#218 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
211
Forks
52
PR merge metrics
No merged PRs in 30d

Description

I have two pointers defined in exactly the same way. And two modules contains `fun` definitions for each pointer. One of them built well. The other complains on unknown type `Ptr`. Apparently, in the second .hs file, a few imports are missing. I could not figure out what caused the difference.

_error message_
```
Not in scope: type constructor or class ‘C2HSImp.Ptr’
Neither ‘Foreign.C.Types’ nor ‘Foreign.ForeignPtr’ exports ‘Ptr’.
```

_pointer definition_
`{#pointer *c_typedef as Typedef foreign finalizer typedef_destroy newtype#}`

_broken .hs generated_
```
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import MyTypes
```

_working .hs generated_
```
import qualified Foreign.C.String as C2HSImp
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import MyTypes
import Foreign -- I have this in .chs
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.