
2 Jun
2007
2 Jun
'07
12:31 p.m.
I'll just keep spamming this list with features I'm missing. I use #pointer to create newtypes, but I'm missing Storable instances for the produced newtypes. It's very nice to be able to use alloca, peek etc for passing pointers around. Even GHC can't derive Storable since the type is recursive, but it's easy to write the instance. Here's what I do now: {#pointer *SWIrecRecognizer as RecRecognizer newtype #} instance Storable RecRecognizer where sizeOf (RecRecognizer r) = sizeOf r alignment (RecRecognizer r) = alignment r peek p = fmap RecRecognizer (peek (castPtr p)) poke p (RecRecognizer r) = poke (castPtr p) r c2hs could easily produce that Storable instance, and I can't see any reason not to. /Björn