Skip to content

concurhaskell/concur-replica

 
 

Repository files navigation

concur-replica

CircleCI

concur-replica is a Concur backend for Replica. As such, you might want to make yourself familiar with both projects first.

Obligatory counter example

{-# 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)

Running the examples

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.

About

Concur backend for Replica

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 100.0%