Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Bärenz authored and turion committed Dec 20, 2024
1 parent 70ba2a1 commit 1a1353c
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 74 deletions.
52 changes: 19 additions & 33 deletions rhine-tree/app/Dommy.hs
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
{-# LANGUAGE ApplicativeDo #-}
import Data.Functor (void)
import Data.Text (Text)
import FRP.Rhine.Tree
import FRP.Rhine.Tree.Types (Content (ContentText), DOM (..), Node (..))
import Language.Javascript.JSaddle
( JSM,
)
import qualified Data.Text as T
import FRP.Rhine (count)

import Control.Concurrent (forkIO)
import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar)
import Control.Lens ((^.))
import Control.Monad (forever)
import Control.Monad.IO.Class (MonadIO (..))
import Data.Monoid ((<>))
import Language.Javascript.JSaddle (
JSM,
askJSM,
fun,
global,
js,
js1,
jsg,
jsg3,
jss,
nextAnimationFrame,
runJSM,
syncPoint,
valToNumber,
valToJSON
)

import FRP.Rhine hiding (forever)
import FRP.Rhine.Tree
import FRP.Rhine.Tree.Types (DOM(..))
import FRP.Rhine.Tree.Types (Node(..), Content (ContentText))

import Data.Text (Text)
default (Text)

main :: JSM ()
Expand All @@ -38,7 +18,13 @@ main = do
flowJSM mainClSF clock

mainClSF :: JSMSF DOM () ()
mainClSF = mconcat
[ appendS $ DOM [Node ("p" :: Text) [] [ContentText ("Hi" :: Text)]]
, permanent $ Node ("p" :: Text) [] [ContentText ("Foo" :: Text)]
]
-- mainClSF = do
-- void $ permanent'' $ Node ("p" :: Text) [] [ContentText ("I bims" :: Text)]
-- void $ permanent'' $ Node ("p" :: Text) [] [ContentText ("I bims hier" :: Text)]
-- mainClSF = (void $ permanent'' $ Node ("p" :: Text) [] [ContentText ("I bims" :: Text)]) *>
-- (void $ permanent'' $ Node ("p" :: Text) [] [ContentText ("I bims hier" :: Text)]) -- FIXME y do notaton no work?
mainClSF = void $ proc () -> do
permanent'' $ Node ("p" :: Text) [] [ContentText ("I bims" :: Text)] -< ()
(_, i) <- permanent'' $ Node ("div" :: Text) [] [ContentText ("I bims hier" :: Text)] -< ()
n <- count -< ()
dynamic (Node "div" [] []) (varying $ Node "p" [] . pure . ContentText) -< T.pack $ show (i, n :: Integer)
4 changes: 4 additions & 0 deletions rhine-tree/rhine-tree.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ common warnings
TypeFamilies
Arrows
ScopedTypeVariables
OverloadedLists
OverloadedStrings

library
Expand All @@ -41,6 +42,9 @@ library
, semialign
, jsaddle
, time
, vector-sized
, vector
, finite-typelits
hs-source-dirs: src

executable dommy
Expand Down
Loading

0 comments on commit 1a1353c

Please sign in to comment.