summaryrefslogtreecommitdiff
path: root/testsuite/tests/javascript/js-ffi-int.hs
blob: bb2effce98c23820e499ddcc1dc33abfe535e3c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import GHC.JS.Prim

foreign import javascript "((x) => { console.log(x); })"
  log_js_int :: JSVal -> IO ()

foreign import javascript "(() => { return 3; })"
  an_int :: JSVal

main :: IO ()
main = do
  log_js_int (toJSInt 0)
  log_js_int (toJSInt 1)
  log_js_int (toJSInt 2)
  log_js_int an_int
  print (fromJSInt an_int)
  print (fromJSInt $ toJSInt 4)