Skip to content

Instantly share code, notes, and snippets.

@jonathanlking
Last active January 6, 2019 12:42
Show Gist options
  • Save jonathanlking/49ed254928c64cf861225126202b6e42 to your computer and use it in GitHub Desktop.
Save jonathanlking/49ed254928c64cf861225126202b6e42 to your computer and use it in GitHub Desktop.
module Main where
import Prelude
import Concur.Core (Widget)
import Concur.React (HTML)
import Concur.React.DOM (button, text)
import Concur.React.Props (onClick)
import Concur.React.Run (runWidgetInDom)
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Console (log)
example :: forall a. Int -> Widget HTML a
example x = do
liftEffect (log $ "example" <> show x)
_ <- button [onClick] [text $ "example" <> show x]
example x
example' :: forall a. Int -> Widget HTML a
example' x = do
_ <- button [onClick] [text $ "example" <> show x]
liftEffect (log $ "example" <> show x)
example' x
main :: Effect Unit
main = do
runWidgetInDom "root" (example 1 <> example 2)
-- runWidgetInDom "root" (example' 1 <> example' 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment