
On Sun, 5 Dec 2010, Lally Singh wrote:
Hey all, I'm trying to get started generating LLVM code, but I'm getting a rather cryptic error.
Btw. there is haskell-llvm@projects.haskell.org
buildReaderFun :: String -> CodeGenModule (Function (IO ())) buildReaderFun nm = do puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr Word8 -> IO Word32) greetz <- createStringNul nm func <- createFunction ExternalLinkage $ do tmp <- getElementPtr0 greetz (0 :: Word32, ())
You have to add a type annotation to greetz like (greetz :: Array D42 Word8) which limits your string to a length of 42 bytes. If you do not know the length, better use withStringNul. I implemented the current behavior, because the former implementation was unsafe.
call puts tmp -- Throw away return value. ret () return func
My attempts at figuring out what type-level has to do with this, and how to satisfy it have so far proven unsuccessful.
type-level provides type level integers, and thus allows for static checking of sizes, such as the number of bits of an integer type.