sodiumfrp

recursive update a “Behaviour” in Sodium yields 'thread blocked …'

孤街浪徒 提交于 2020-01-15 05:41:28
问题 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