module System.Chatty.Misc where

import Data.Time.Clock
import System.Random

class (Functor m,Monad m) => MonadClock m where
  mutctime :: m UTCTime
  mgetstamp :: m DiffTime
  mgetstamp = fmap utctDayTime 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