{-# LANGUAGE ForeignFunctionInterface #-} module GrepWrap where import Foreign import Foreign.C.String import Data.Char printCString :: CString -> IO () printCString s = do ss <- peekCString s putStrLn ss getCStringFromKey :: IO CString getCStringFromKey = do guess <- getLine newCString guess hello :: IO() hello = do putStrLn "Hi there!" foreign export stdcall hello :: IO () foreign export stdcall printCString :: CString -> IO () foreign export stdcall getCStringFromKey :: IO CString