id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
7048,Add the ability to statically define a `FunPtr` to a haskell function,pcapriotti,,"Lauri Alanko [http://haskell.1045720.n5.nabble.com/Static-non-exported-stubs-td5713489.html suggests] that there should be a way to define a callback to a haskell function statically (i.e. without using a dynamic wrapper).

It is currently possible to do so only by exporting the function and reimporting it as a function pointer:

{{{
foreign export ccall ""my_callback"" myCallback :: IO ()
foreign import ccall ""&my_callback"" myCallbackPtr :: FunPtr (IO ())
}}}

but of course this not ideal because it creates an extra symbol (and is quirky).

A possible new syntax could be:

{{{
foreign import ccall myCallbackPtr :: FunPtr (IO ()) = myCallback
}}}

or variations thereof. We probably want to keep `import` (rather than `export` or some new keyword), since this declaration brings something into scope, like a normal FFI import.",feature request,new,normal,7.8.1,Compiler,7.4.2,,,la@… iavor.diatchki@…,Unknown/Multiple,Unknown/Multiple,None/Unknown,Unknown,,,,
