Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deal with semi-standard types. #134

Open
phadej opened this issue Sep 1, 2024 · 2 comments
Open

How to deal with semi-standard types. #134

phadej opened this issue Sep 1, 2024 · 2 comments
Assignees

Comments

@phadej
Copy link
Collaborator

phadej commented Sep 1, 2024

Like uint64_t (from <stdint.h>) or e.g. clock_t. These are probably typedefs in the standard library. As long as C compiler is considered, it would just expand these and don't see an abstraction. (Not sure what happens as library segfaults, #131(. But arguably in Haskell bindings it could make sense to preserve the abstraction and use Word64 and CClock respectively.

hs-bindgen could have a mode for host preprocessing (generating target-independent .hsc files, i.e. doing what people do now manually); then library writers won't expose dependency on their librarary users. Personally that's the mode which I'd use. In that mode preserving an abstraction is probably a must have.

@phadej
Copy link
Collaborator Author

phadej commented Sep 4, 2024

In #131 we still see uint64_t fields as typedefs. So this will depend on how we will deal with typedefs (are they types or newtypes or whether it depends).

@edsko
Copy link
Collaborator

edsko commented Sep 14, 2024

Turns out we do see uint64_t and clock_t; see #176. That doesn't of course answer the question of how to deal with these; I guess we should have a prelude of standard types, which can be extended. I can take a first stab at this.

@edsko edsko self-assigned this Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants