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

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

foreign import javascript "(() => { return 'a string'; })"
  a_string :: JSVal

main :: IO ()
main = do
  log_js_string (toJSString "test")
  putStrLn (fromJSString a_string)
  putStrLn (fromJSString $ toJSString "test")