-
-
Save Wizek/646f7a6063b18d6ad21e7748504f77ba to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env nix-shell | |
#! nix-shell -p "haskell.packages.ghc822.ghcWithPackages (p: with p; with haskell.lib; [(doJailbreak (dontCheck jsaddle-warp))])" | |
#! nix-shell -i "runghc" | |
{-# language OverloadedStrings #-} | |
import Control.Monad.IO.Class | |
import Language.Javascript.JSaddle.Warp | |
import Language.Javascript.JSaddle | |
import Language.Javascript.JSaddle.Debug | |
import Control.Concurrent | |
import Control.Monad | |
import Data.Text | |
import Control.Concurrent.MVar | |
main = run 3197 $ do | |
result <- liftIO newEmptyMVar | |
deRefVal $ call (eval "(function(f) {f('Hello');})") global [fun $ \ _ _ [arg1] -> do | |
valToText arg1 >>= (liftIO . putMVar result) | |
] | |
liftIO $ takeMVar result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment