Skip to content

c2hs should derive and use default marshallers from enum and pointer hooks #31

Closed
@ian-ross

Description

@ian-ross

Bug imported from C2HS Trac

Trac ticket created: 2010-05-27T17:26:12-0700


This is a FIXME in the source code, and I'm working on bindings that would really benefit from the DRY aspect of this feature.

Specifically, c2hs should derive the following in/out marshallers:

  • fromIntegral . fromEnum and toEnum . fromIntegral from an enum hook
  • id and id from both naked and newtype pointer hooks
  • withForeignPtr and newForeignPtr_ for foreign pointer hooks
  • withPointerType (the generated function) and PointerType . newForeignPtr_ for foreign newtype pointer hooks. The out marshaller is not great here, a !ForeignPtr with no finalizers is not terribly useful concealed inside the newtype. Perhaps foreign newtype should be left naked, or furnished with an 'in' default marshaller only.

Since I don't enjoy giving work to other people, I volunteer to add this functionality and submit a patch. This ticket is created for tracking purposes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions