Hi, here is the fficookbook: http://www.haskell.org/haskellwiki/FFICookBook
and this is the pdf I wrote 7 years ago. http://www.tbi.univie.ac.at/~choener/haskell/introduction_haskell_ffi.pdf I hope it's useful, ... 7 years is a long time [1] ;-) == For stuff returning 'void', I'd write a wrapper in IO-land, examine what you got back in the pointer and pack that up into Haskell structures. There is s.th. of that kind on tree structures in the pdf. Gruss, Christian [1] not only in terms of Haskell evolution but also my own as a Haskell user... * Dan Fornika <dforn...@gmail.com> [20.08.2012 21:52]: > I've looked around at what my options are for writing C wrappers. I > made a first attempt using hsc2hs, based mostly off of the examples > given in "Real World Haskell." > > After running into difficulty there, I thought I might try using c2hs, > following this series of blog posts: > > http://blog.ezyang.com/2010/06/the-haskell-preprocessor-hierarchy/ > > ... and also modeled after Nick Ingolia's samtools wrapper: > > https://github.com/ingolia/SamTools/tree/master/samtools > > I have taken a brief look at gtk2hs, but that is a fairly large project > in comparison to what I'd like to do, and I had trouble boiling it down > into a useful 'template' to base my work off of. > > But I think that I might be relying a bit too heavily on examples and > tutorials without fully understanding how I want the overall design of > my wrapper to work. > > I have found it fairly difficult to find good tutorials on the subject, > so I'd be interested in anything you've written that you could provide a > link to. > > One seemingly simple concept that I can't seem to find an answer to is > how one determines the output type of an 'effectful' C function by > looking at the header. In the library that I'm working on, there are > several functions that take pointers to structs as input, perform > side-effects on those structs, and return 'void' as output. So if there > is a haskell function that makes a foreign call to one of those > functions, does it simply return IO ()? > > Maybe that's a bit of a vague question, so don't worry about detailed > answers, but that is they type of thing that I've been struggling with. > > Dan > > Christian Höner zu Siederdissen: > > Hi Dan, > > > > part of the fault is indeed to be found with the summer. There has been > > an important RNA meeting a couple of weeks ago, and ICFP is only three > > weeks away ;-) > > > > That being said, a new version of ADPfusion should be ready this week, > > making it significantly easier to write grammars and algebras for CFGs > > and similar things. > > > > Instead of having to write > > f <<< base -~+ table +~- base > > you now just write > > f <<< base % table % base > > meaning the width of each (non-) terminal is now encoded in the (non-) > > terminals and not the combinators anymore. > > > > With some additional improvements and the extreme goodness of constraint > > kinds, I believe the library closes to ADP usability and should have > > surpassed it in some instances, now. > > > > I have some major changes planned for ``my'' libraries during the fall, > > to expend general usability, and have many ideas from the Benasque RNA > > meeting to be implemented. During ICFP I hope to do some hands-on stuff > > with SIMD for ADPfusion. > > > > ADPfusion my highest-priority project right now, as I want to base all > > my existing tools on it to improve performance -- by a lot in some > > cases. > > > > == > > > > Regarding you wrapper project, do you want to write them yourself? I > > wrote a tutorial some years ago on how to do that stuff. For more > > automated work, look toward gtkhs. > > > > Gruss, > > Christian > > > > * Dan Fornika <dforn...@gmail.com> [20.08.2012 21:10]: > >> Hello Biohaskellers, > >> > >> There hasn't been much action on the mailing list lately. I'm curious > >> what people are working on. > >> > >> It seems like there is a lot of work to be done on splitting the > >> monolithic biolib down into smaller libraries, but there doesn't seem to > >> be much progress lately. > >> > >> So what's going on? Is everyone out enjoying the sunshine? Have people > >> receded back into the swamp of BioPerl? > >> > >> Lately I've been trying to learn how to wrap a C library with the FFI. > >> I'd like to wrap Dr. Jason Moore's Multifactor Dimensionality Reduction > >> library (libmdr), but I've found it really very difficult to manage the > >> conversion between C types and structs, and haskell types. > >> > >> But I'm not asking for advice here, I'm just curious what people are up > >> to, and what you see as high priority tasks to improve the biohaskell > >> libraries. > >> > >> Dan > >> _______________________________________________ > >> Biohaskell mailing list > >> Biohaskell@biohaskell.org > >> http://malde.org/cgi-bin/mailman/listinfo/biohaskell >
pgphmfbpA0VBe.pgp
Description: PGP signature
_______________________________________________ Biohaskell mailing list Biohaskell@biohaskell.org http://malde.org/cgi-bin/mailman/listinfo/biohaskell