Skip to content

Instantly share code, notes, and snippets.

@pasberth
Created April 9, 2014 11:18
Show Gist options
  • Select an option

  • Save pasberth/10256596 to your computer and use it in GitHub Desktop.

Select an option

Save pasberth/10256596 to your computer and use it in GitHub Desktop.
GHCJS FFI
{-# LANGUAGE JavaScriptFFI #-}
import GHCJS.Foreign
import GHCJS.Types
import Control.Applicative
foreign import javascript unsafe "document.getElementById($1).innerHTML" js_unsafeGetElementById :: JSString -> IO JSString
main = do
str <- fromJSString <$> js_unsafeGetElementById (toJSString "hoge")
putStrLn str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment