forked from norm2782/uhc-jscript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Language.UHC.JScript.ECMA.String | ||
import Language.UHC.JScript.Assorted | ||
import Language.UHC.JScript.Primitives | ||
import Language.UHC.JScript.JQuery.JQuery | ||
import UHC.Ptr | ||
|
||
|
||
foreign import jscript "getJSFun(%1)" | ||
getJSFun :: Int -> FunPtr (Int -> Int) | ||
|
||
foreign import jscript "dynamic" | ||
mkDyn :: FunPtr (Int -> Int) -> (Int -> Int) | ||
|
||
main :: IO () | ||
main = do | ||
putStrLn "import_dynamic" | ||
let jfn = getJSFun 2 | ||
let hfn = mkDyn jfn | ||
print $ hfn 3 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
function some_function(arg1, arg2, callback) { | ||
var num = Math.ceil(arg1 + arg2); | ||
var res = callback(num); | ||
return res; | ||
} | ||
function getJSFun(x) { | ||
return function(y) { | ||
return x + y; | ||
}; | ||
}; |