packages feed

MicroHs-0.17.4.0: tests/ForImpForall.hs

module ForImpForall where
import Foreign.Ptr

-- Foreign imports with an explicit forall in their type, as GHC allows.
-- abs gets a C wrapper generated by the compiler; free is in the runtime's FFI table.
foreign import ccall "abs"  cabs  :: forall a . Int -> Int
foreign import ccall "free" cfree :: forall a . Ptr a -> IO ()

main :: IO ()
main = do
  print (cabs (-3))
  cfree nullPtr
  putStrLn "done"