[haskell-llvm] [Haskell-cafe] LLVM, type-level?
Henning Thielemann
lemming at henning-thielemann.de
Fri Dec 10 05:35:45 EST 2010
On Thu, 9 Dec 2010, Lally Singh wrote:
> So how do I make it work with Ptr (Ptr Word8)?
>
> Here's what I'm building: https://gist.github.com/734713 (it's 15
> lines, and I've included the compiler complaint.)
>
> 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))
I think the type annotation is wrong. It must be
argv ::Value (Ptr (Ptr Word8))
> (0 :: Int32, ())
> call puts tmp -- Throw away return value.
> ret (0 :: Int32)) :: CodeGenModule (MainFunction)
>
> withStringNul nm callPuts
>
More information about the Haskell-llvm
mailing list