Skip to content

Instantly share code, notes, and snippets.

@robstewart57
Last active December 27, 2015 10:09
Show Gist options
  • Save robstewart57/7309396 to your computer and use it in GitHub Desktop.
Save robstewart57/7309396 to your computer and use it in GitHub Desktop.
Using values that are not first class in LLVM
module Main where
import Data.Int
import LLVM.Core
import LLVM.ExecutionEngine
notFirstClass :: CodeGenModule (Function ([Int8] -> IO [Int8]))
notFirstClass = do
test <- createNamedFunction ExternalLinkage "test" $ \x -> do
ret x
let _ = test :: Function ([Int8] -> IO [Int8])
return test
main :: IO ()
main = do
initializeNativeTarget
xs <- simpleFunction notFirstClass
xs [1,2,3] >>= print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment