Skip to content

Instantly share code, notes, and snippets.

@mokshasoft
Created May 12, 2020 06:10
Show Gist options
  • Save mokshasoft/e0d3b39b2be5bbd766d93605a4d7e48d to your computer and use it in GitHub Desktop.
Save mokshasoft/e0d3b39b2be5bbd766d93605a4d7e48d to your computer and use it in GitHub Desktop.
Idris Gambit CG: Can't pass argument of type %World to foreign function
%foreign "C:applyFn,libsome"
prim_applyFnIO : (PrimIO ()) -> PrimIO ()
applyFnIO : (IO ()) -> IO ()
applyFnIO f = primIO $ prim_applyFnIO (toPrim f)
main : IO ()
main = applyFnIO $ putStrLn "hello"
bug: nobug1-check bug1-check nobug1 bug1
bug1-check:
idris2 -c --cg chez Bug1.idr
idris2 -c --cg gambit Bug1.idr
nobug1-check:
idris2 -c --cg chez NoBug1.idr
idris2 -c --cg gambit NoBug1.idr
bug1:
idris2 --cg chez Bug1.idr -o c_bug1
idris2 --cg gambit Bug1.idr -o g_bug1
nobug1:
idris2 -c --cg chez NoBug1.idr -o c_nobug1
idris2 -c --cg gambit NoBug1.idr -o g_nobug1
%foreign "C:applyFn,libsome"
prim_applyFnIO : (String -> PrimIO ()) -> PrimIO ()
applyFnIO : (String -> IO ()) -> IO ()
applyFnIO f = primIO $ prim_applyFnIO (\str => toPrim $ f str)
main : IO ()
main = applyFnIO $ putStrLn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment