WASM hello world
This commit is contained in:
parent
38838c47b9
commit
77ee0c0abb
9 changed files with 121 additions and 46 deletions
19
app/App.hs
Normal file
19
app/App.hs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module App where
|
||||
|
||||
import Reflex
|
||||
import Reflex.Dom.Core
|
||||
|
||||
import Language.Javascript.JSaddle
|
||||
|
||||
testWidget ::
|
||||
( DomBuilder t m
|
||||
, DomBuilderSpace m ~ GhcjsDomSpace
|
||||
, MonadHold t m
|
||||
, PostBuild t m
|
||||
) =>
|
||||
m ()
|
||||
testWidget = elAttr "div" ("class" =: "content") do
|
||||
text "hello, world!"
|
||||
|
||||
start :: JSM ()
|
||||
start = mainWidget testWidget
|
||||
10
app/Main.hs
10
app/Main.hs
|
|
@ -1,4 +1,12 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Main (main) where
|
||||
|
||||
import App qualified
|
||||
import Language.Javascript.JSaddle
|
||||
import Language.Javascript.JSaddle.Wasm qualified as W
|
||||
|
||||
foreign export javascript "hs_start" main :: IO ()
|
||||
|
||||
main :: IO ()
|
||||
main = putStrLn "hi"
|
||||
main = W.run $ App.start
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue