\(\newcommand{\lb}{\unicode{x27E6}}\) \(\newcommand{\rb}{\unicode{x27E7}}\)
Behavior (Int, Int)
Event Char
(From reactive-banana
documentation.)
Behavior a
Event a
mouse :: Behavior (Int, Int)
keypress :: Event KeyCode
click :: Event (Int, Int)
data TextWidget = {
text :: Behavior String
typed :: Event ()
}
-- robotics
camera :: Behavior Image
bump :: Event ()
when :: B Bool -> E a -> E a
at :: B a -> E b -> E a
union :: E a -> E a -> E a
steps :: E a -> B a
foldP :: (a -> b -> b) -> E a -> E b
set :: Element -> Attribute a ->
B a -> IO ()
handle :: E a -> (a -> IO ()) -> IO ()
Game code:
blank :: Int -> Int -> Grid
rPentonimo :: Grid
step :: Grid -> Grid
modify :: (Int, Int) -> Grid -> Grid
canvas
: contains game of lifepauseButton
: pauses animationtimer
: sends an event every 200 milliseconds-- every 200ms from timer
ticks :: Event ()
mouse :: Behavior Point
click :: Event ()
-- button presses
pauses :: Event ()
f $ x = f x
f <$> xs = fmap f xs
x' <$ xs = fmap (const x') xs
() <$ [1,2,3,4] = [(), (), (), ()]
active <- accumB False (not <$ pauses)
steps, modifies :: Event (Grid -> Grid)
steps = whenE active (step <$ ticks)
modifies = modify . adjust <$> clicks
changes = updates `union` modifies
life <- accumE start changes
generation <- accumB 0 ((+ 1) <$ steps)
reactive-banana
threepenny-gui
:
reactive-banana
reflex-frp
reflex-platform
IO
typeCreated by Tikhon Jelvis.