[Haskell-beginners] FFI export lazy list of string

Edward Z. Yang ezyang at MIT.EDU
Mon Dec 5 20:13:07 CET 2011


Hello Alexander,

Your best bet is to make a Haskell functions which gives access to
the head and tail of a list (the head should be converted into a C-friendly
form) and then export them as functions which are callable from C.

http://www.haskell.org/haskellwiki/GHC/Using_the_FFI#Calling_Haskell_from_C

Edward

Excerpts from Alexander.Vladislav.Popov's message of Mon Dec 05 03:08:59 -0500 2011:
> Hi, Haskellers.
> 
> Advise me please, how I can export lazy and potentially infinite list of
> string from Haskell program. I think I must call it iteratively: the first
> call initiate some structure and other calls iterate over it, something
> like pair of function `find_first' and `find_next'. And how to marshall
> this structure between programs. Or think in a wrong way? Does any example
> exist how I can make it?
> 
> Alexander Popov



More information about the Beginners mailing list