foundation icon indicating copy to clipboard operation
foundation copied to clipboard

Class instances for types from Foreign.C.Types

Open dtaskoff opened this issue 8 years ago • 1 comments

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.

dtaskoff avatar Oct 30 '17 13:10 dtaskoff

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 avatar Nov 11 '17 09:11 vincenthz