module System.Chatty.Misc where
import Data.Time.Clock
import Data.Time.Calendar
import System.Random
class (Functor m,Monad m) => MonadClock m where
mutctime :: m UTCTime
mgetstamp :: m NominalDiffTime
mgetstamp = fmap (diffUTCTime (UTCTime (fromGregorian 1970 1 1) (secondsToDiffTime 0))) mutctime
instance MonadClock IO where
mutctime = getCurrentTime
class Monad m => MonadRandom m where
mrandom :: Random r => m r
mrandomR :: Random r => (r,r) -> m r
instance MonadRandom IO where
mrandom = randomIO
mrandomR rs = randomRIO rs