Skip to content

Commit

Permalink
Add reflex-todomvc
Browse files Browse the repository at this point in the history
  • Loading branch information
amesgen committed Oct 26, 2024
1 parent 29f97c9 commit ee587a4
Show file tree
Hide file tree
Showing 7 changed files with 386 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:
- uses: dw-labs-org/dart-sass-gha@v1

- name: install-happy
run: |
cabal path --installdir >> "$GITHUB_PATH"
cabal update -z
cabal install -z happy
- name: build-frontend
run: |
cd frontend
Expand Down Expand Up @@ -85,6 +91,12 @@ jobs:

- uses: dw-labs-org/dart-sass-gha@v1

- name: install-happy
run: |
cabal path --installdir >> "$GITHUB_PATH"
cabal update -z
cabal install -z happy
- name: build-frontend
run: |
cd frontend
Expand Down
2 changes: 2 additions & 0 deletions app/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module App (start) where

import GHC.Wasm.Prim
import Language.Javascript.JSaddle (JSM)
import Reflex.TodoMVC qualified
import SimpleCounter qualified
import Snake qualified
import TodoMVC qualified
Expand All @@ -16,4 +17,5 @@ start e =
"todomvc" -> TodoMVC.start
"xhr" -> XHR.start
"2048" -> TwoZeroFourEight.start
"reflex-todomvc" -> Reflex.TodoMVC.main
_ -> fail "unknown example"
13 changes: 12 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages: . hs2048
packages: . hs2048 reflex-todomvc

index-state: 2024-10-26T13:27:42Z

Expand All @@ -20,3 +20,14 @@ if arch(wasm32)

package aeson
flags: -ordered-keymap

-- for reflex-frp

-- GHC 9.10 compat
source-repository-package
type: git
location: https://github.com/amesgen/reflex-dom
tag: e43e0525d643f656a0a5b0f10e13e2a04712cd4e
subdir: reflex-dom-core

allow-newer: dependent-sum-template:template-haskell
12 changes: 12 additions & 0 deletions frontend/reflex-todomvc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TodoMVC | Reflex FRP example via GHC WASM</title>
</head>
<body>
<script>globalThis.example = "reflex-todomvc";</script>
<script src="index.js" type="module"></script>
</body>
</html>
1 change: 1 addition & 0 deletions ghc-wasm-miso-examples.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ executable ghc-wasm-miso-examples
, miso
, mtl
, random
, reflex-todomvc
, text
hs-source-dirs: app
default-language: GHC2021
Expand Down
25 changes: 25 additions & 0 deletions reflex-todomvc/reflex-todomvc.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Cabal-version: 3.0
Name: reflex-todomvc
Version: 0.1
Synopsis: Functional Reactive TodoMVC
Description: An implementation of the TodoMVC specification using the Reflex-DOM functional reactive DOM library
License: BSD-3-Clause
License-file: LICENSE
Author: Ryan Trinkle
Maintainer: [email protected]
Stability: Experimental
Category: FRP

library
hs-source-dirs: src
build-depends:
base,
reflex,
ghcjs-dom == 0.9.*,
reflex-dom-core,
containers,
text,
mtl
exposed-modules:
Reflex.TodoMVC
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
322 changes: 322 additions & 0 deletions reflex-todomvc/src/Reflex/TodoMVC.hs

Large diffs are not rendered by default.

0 comments on commit ee587a4

Please sign in to comment.