{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module FRP.Rhine.Clock.Realtime.Stdin where
import Data.Time.Clock
import Data.Semigroup
import Control.Monad.IO.Class
import FRP.Rhine
data StdinClock = StdinClock
instance MonadIO m => Clock m StdinClock where
type TimeDomainOf StdinClock = UTCTime
type Tag StdinClock = String
startClock _ = do
initialTime <- liftIO getCurrentTime
return
( arrM_ (liftIO getCurrentTime)
&&& arrM_ (liftIO getLine)
, initialTime
)
instance Semigroup StdinClock where
_ <> _ = StdinClock
instance Monoid StdinClock where
mempty = StdinClock
mappend _ _ = StdinClock