Skip to content

Instantly share code, notes, and snippets.

@MarcelineVQ
Created August 31, 2020 22:56
Show Gist options
  • Select an option

  • Save MarcelineVQ/b9f5d7e13fcc19d9748941276003cbbf to your computer and use it in GitHub Desktop.

Select an option

Save MarcelineVQ/b9f5d7e13fcc19d9748941276003cbbf to your computer and use it in GitHub Desktop.
-- Not compelete since it doesn't go to HasIO yet, but given:
-- makeHasIO "what" ["c:foo","javascript:borp"] `[ prim_gob : Int -> Int -> PrimIO Int ]
-- This generates:
-- %foreign "c:foo" "javascript:borp"
-- what : Int -> Int -> PrimIO Int
makeHasIO : String -> List String -> List Decl -> Elab ()
makeHasIO funname str ys = do
[IClaim fc mw vis _ (MkTy tyfc _ ty)] <- pure ys
| _ => fail "bad format"
let r = IClaim fc mw vis [ForeignFn str] (MkTy tyfc (UN funname) ty)
-- spits out what r is when :log 1 is set in repl
quote r >>= logTerm "as" 1 "fds"
declare [r]
%runElab makeHasIO "what" ["c:foo","javascript:borp"] `[ prim_gob : Int -> Int -> PrimIO Int ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment