1 {-# LANGUAGE ScopedTypeVariables #-}
3 module RMCA.Auxiliary.RV where
6 import Data.ReactiveValue
8 newCBMVarRW :: forall a. a -> IO (ReactiveFieldReadWrite IO a)
12 getter = readCBMVar mvar
14 setter = writeCBMVar mvar
15 notifier :: IO () -> IO ()
16 notifier = installCallbackCBMVar mvar
17 return $ ReactiveFieldReadWrite setter getter notifier
19 emptyRW :: (Monoid b, ReactiveValueReadWrite a b m) => a -> m b
21 val <- reactiveValueRead rv
22 reactiveValueWrite rv mempty
25 emptyW :: (Monoid b, ReactiveValueWrite a b m) => a -> m ()
26 emptyW rv = reactiveValueWrite rv mempty