Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Class instances for types from Foreign.C.Types #429

Open
dtaskoff opened this issue Oct 30, 2017 · 1 comment
Open

Class instances for types from Foreign.C.Types #429

dtaskoff opened this issue Oct 30, 2017 · 1 comment
Labels
C - numerical numerical stuff D - easy Difficulty easy for beginners T - string Affect type Strings

Comments

@dtaskoff
Copy link
Contributor

Why does only the CSize from Foreign.C.Types has instances for Additive, etc.?
If there is not a reason for that, I'm willing to implement those instances for all types from Foreign.C.Types.
If that's alright, perhaps these instances should be in modules Basement.FFI.Additive, etc. and Foundation.FFI (or C.Types instead of FFI)?

Note: I think that at some stage, it would be nice to implement the things from Foreign.C.String using the Foundation's String.

@vincenthz
Copy link
Member

vincenthz commented Nov 11, 2017

I can't think of a reason why it's not implemented yet. PR welcomed.

I don't think you'll be able to have those instance in anywhere else than Basement.Numerical.* since otherwise you'll hit the OrphanInstance problem.

Also for Foreign.C.String, It sounds like a good idea to me ! Also you probably want to be able to distinguish Ptr from ReadOnlyPtr and WriteOnlyPtr for efficiency purpose here (due to foundation String dual pinning system)

@vincenthz vincenthz added C - numerical numerical stuff D - easy Difficulty easy for beginners T - string Affect type Strings labels Nov 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C - numerical numerical stuff D - easy Difficulty easy for beginners T - string Affect type Strings
Projects
None yet
Development

No branches or pull requests

2 participants