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

c2hs cvs-ghc at haskell.org
Thu May 27 20:26:13 EDT 2010


#31: c2hs should derive and use default marshallers from enum and pointer hooks
--------------------+-------------------------------------------------------
 Reporter:  guest   |        Type:  enhancement
   Status:  new     |    Priority:  normal     
Milestone:          |   Component:  general    
  Version:  0.16.0  |    Keywords:             
--------------------+-------------------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/31>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell


More information about the C2hs mailing list