summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/2469.hs
blob: dc68ad73bf54e0f82f052a5b91d7d54d232dd061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import Foreign
import Foreign.C

type IOF = Int -> IO Int

foreign import ccall "wrapper" wrap_f_io :: IOF -> IO (FunPtr IOF)
foreign import ccall "dynamic" f_io :: FunPtr IOF -> IOF

double_io :: Int -> IO Int
double_io x = return (x * 2)

main = do
  double2 <- wrap_f_io double_io
  x <- f_io double2 42
  return ()