concur-replica
is a Concur backend for Replica. As such, you might want to make yourself familiar with both projects first.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Concur.Core
import Concur.Replica
import Prelude hiding (div)
counter :: Int -> Widget HTML a
counter x = do
click <- div []
[ Left <$> div [ onClick ] [ text "-" ]
, text $ T.pack $ show x
, Right <$> div [ onClick ] [ text "+" ]
]
case click of
Left _ -> counter (x - 1)
Right _ -> counter (x + 1)
main :: IO ()
main = runDefault 8080 "Counter" (counter 0)
The examples are mostly taken from concur-react
, but there are a couple of new ones under examples/Misc
as well.
stack build
stack exec concur-replica-(calc|hilo|menu|misc|multi-entry)
Point your browser to http://localhost:8080
and behold the remote VDOM goodness.