Skip to content

Commit 6c59150

Browse files
authored
Server setup for behaviors (#84)
1 parent d14f1f4 commit 6c59150

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.psc-ide-port
12
.pulp-cache/
23
.psci_modules/
34
.stack-work/

staging/behaviors/psc-package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "trybehaviors",
3+
"set": "master",
4+
"source": "https://github.com/purescript/package-sets.git",
5+
"depends": [
6+
"drawing",
7+
"behaviors",
8+
"prelude"
9+
]
10+
}

staging/behaviors/src/FRP/Try.purs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module FRP.Try (defaultMain) where
2+
3+
import Prelude
4+
5+
import Control.Monad.Eff (Eff)
6+
import Data.Foldable (for_)
7+
import FRP (FRP)
8+
import FRP.Behavior (Behavior, animate)
9+
import Graphics.Canvas (CANVAS, getCanvasElementById, getContext2D)
10+
import Graphics.Drawing (Drawing, render)
11+
12+
defaultMain :: Behavior Drawing -> Eff (canvas :: CANVAS, frp :: FRP) Unit
13+
defaultMain b = do
14+
canvas <- getCanvasElementById "canvas"
15+
for_ canvas \c -> do
16+
ctx <- getContext2D c
17+
animate b (render ctx)

0 commit comments

Comments
 (0)