module Runtime.Probe where

import Reactive.QState (QState,initQState)

import FRP.UISF
import System.IO.Unsafe (unsafePerformIO)
import Data.IORef
import Reactive.QState
import Tile.QList


{-# NOINLINE globalDirtyVar #-}
globalDirtyVar = unsafePerformIO (newIORef Nothing)



writeProbe = arr Just >>> liftAIO (writeIORef globalDirtyVar) >>> (returnA :: UISF a a)


readProbe = constA globalDirtyVar
  >>> liftAIO readIORef
  >>> arr (\s -> case s of
              Just s ->(size_qlist (qlist s), width_qlist (qlist s))
              Nothing -> (0,0))
  
  >>> (returnA :: UISF a a)