type synonyms for dynamic imports and wrappers

Henning Thielemann lemming at henning-thielemann.de
Thu Aug 18 15:17:08 UTC 2016


The Haskell FFI report says that imports and exports of dynamic functions 
always have those types:

foreign import ccall "dynamic"
   mkFun :: FunPtr fun -> fun

foreign import ccall "wrapper"
   mkCallback :: fun -> IO (FunPtr fun)

where 'fun' is an IO function. Since 'fn' can be a considerably large type 
expression I usually define

type Importer fun = FunPtr fun -> fun
type Exporter fun = fun -> IO (FunPtr fun)


How about adding these type synonyms to Foreign?


More information about the Libraries mailing list