i would update a Behaviour (Cell / Val) from it's current value.
but the following code throws a thread blocked indefinitely in an MVar operation exception.
i have expected it prints three times 'value of i: '. what did i missing? - thanks.
{-# LANGUAGE RecursiveDo #-}
module Main where
import FRP.Sodium
main :: IO ()
main = do
(e, t) <- sync newEvent
rec
b <- sync $ hold 0 $ snapshot (\_ i -> i + 1) e b
sync $ listen (value b) (\i -> putStrLn $ "value of i: " ++ show i)
sync $ t "ping"
sync $ t "ping"
sync $ t "ping"
return ()
- GHCi, version 7.8.3
- sodium-0.11.0.3