Created
December 9, 2010 13:39
-
-
Save lally/734713 to your computer and use it in GitHub Desktop.
It should print out its first argument via a call to puts().
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type MainFunction = Function (Int32 -> Ptr (Ptr Word8) -> IO Int32) | |
buildReaderFun :: String -> CodeGenModule (MainFunction) | |
buildReaderFun nm = do | |
puts <- newNamedFunction ExternalLinkage "puts" :: | |
TFunction (Ptr Word8 -> IO Word32) | |
let callPuts format = ( | |
createNamedFunction ExternalLinkage "main" $ | |
\ argc argv -> do | |
tmp <- getElementPtr (argv ::Value (Ptr Word8)) | |
(0 :: Int32, ()) | |
call puts tmp -- Throw away return value. | |
ret (0 :: Int32)) :: CodeGenModule (MainFunction) | |
withStringNul nm callPuts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/research/phd/libmet/Listener.hs:1:0:
Couldn't match expected type
Word8' against inferred type
Ptr Word8'Expected type: Value (Ptr Word8) -> CodeGenFunction r Terminate
Inferred type: Value (Ptr (Ptr Word8)) -> b'
When using functional dependencies to combine
FunctionArgs (a -> b) (Value a -> b') r,
arising from the dependency
f -> g r' in the instance declaration at <no location info> FunctionArgs (Ptr (Ptr Word8) -> IO Int32) (Value (Ptr Word8) -> CodeGenFunction r Terminate) (CodeGenFunction r ()), arising from a use of
createNamedFunction'