-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library to mock the current time. -- -- A library to mock the current time and relevant IO functions by using -- a type class. You can get the great command of the current time in -- UTC, time zones, and the speed of time. @package time-machine @version 0.1.0 module Control.Monad.TimeMachine.Engine -- | A class of monads in which you can obrain the mocked current time and -- relevant information. class (Monad m) => MonadTime m getCurrentTime :: MonadTime m => m UTCTime getCurrentTZ :: MonadTime m => m TZ getCurrentTimeScale :: MonadTime m => m TimeScale -- | Returns the mocked time zone at the given point of time. getTimeZone :: (MonadTime m) => UTCTime -> m TimeZone -- | Returns the mocked time zone at the mocked current time. getCurrentTimeZone :: (MonadTime m) => m TimeZone -- | Returns the mocked local time at the given point of time. utcToLocalZonedTime :: (MonadTime m) => UTCTime -> m ZonedTime -- | Returns the mocked local time at the mocked current time. getZonedTime :: (MonadTime m) => m ZonedTime -- | An alias of getCurrentTZ. loadLocalTZ :: (MonadTime m) => m TZ -- | Switches the MonadTime contexts. You can specify all of the -- point of time, the time zone and the setting of speed for mocking at -- once. departFor :: (MonadIO m, MonadTime m) => Destination -> TimeZoneName -> Acceleration -> TimeMachineT m a -> m a -- | Switches the mocked current time in the context. travelTo :: (MonadIO m, MonadTime m) => Destination -> TimeMachineT m a -> m a -- | An alias of travelTo. backTo :: (MonadIO m, MonadTime m) => Destination -> TimeMachineT m a -> m a -- | Switches the mocked current time zone in the context. jumpTo :: (MonadIO m, MonadTime m) => TimeZoneName -> TimeMachineT m a -> m a -- | Changes the mocked speed of time in the context. accelerate :: (MonadIO m, MonadTime m) => Acceleration -> TimeMachineT m a -> m a -- | Stops the time to advence in the context. halt :: (MonadIO m, MonadTime m) => TimeMachineT m a -> m a -- | A data type to represents the speed of time. It corresponds how many -- seconds are in the real second, i.e. TimeScale 1 is -- equivalent to the real speed of time. newtype TimeScale TimeScale :: NominalDiffTime -> TimeScale [unTimeScale] :: TimeScale -> NominalDiffTime -- | A data type to represent a point of time for mocking. data Destination -- | Nothing to mock. None :: Destination -- | An absolute point in UTC. Absolute :: UTCTime -> Destination -- | A local time in the mocked current time zone. Zoned :: LocalTime -> Destination -- | An interval from the mocked current time. Relative :: TimeInterval -> Destination -- | A data type to represent intervals for constructing a -- Destination. data TimeInterval Minutes :: Integer -> TimeInterval Hours :: Integer -> TimeInterval Days :: Integer -> TimeInterval Weeks :: Integer -> TimeInterval Months :: Integer -> TimeInterval Years :: Integer -> TimeInterval -- | Names of time zones, e.g. "Asia/Tokyo" or -- "Europe/Paris". type TimeZoneName = String -- | A data type to represent how to change the mocked speed of time. data Acceleration -- | Nothing to change. Keep :: Acceleration -- | Sets the speed to the given scale. Velocity :: TimeScale -> Acceleration -- | Sets the speed acccording to the current speed. Factor :: TimeScale -> Acceleration -- | A monad transformer to stack the MonadTime contexts. data TimeMachineT m a instance GHC.Show.Show Control.Monad.TimeMachine.Engine.Acceleration instance GHC.Classes.Eq Control.Monad.TimeMachine.Engine.Acceleration instance GHC.Show.Show Control.Monad.TimeMachine.Engine.Destination instance GHC.Classes.Eq Control.Monad.TimeMachine.Engine.Destination instance GHC.Show.Show Control.Monad.TimeMachine.Engine.TimeInterval instance GHC.Show.Show Control.Monad.TimeMachine.Engine.Spacetime instance GHC.Classes.Eq Control.Monad.TimeMachine.Engine.Spacetime instance GHC.Num.Num Control.Monad.TimeMachine.Engine.TimeScale instance GHC.Classes.Ord Control.Monad.TimeMachine.Engine.TimeScale instance GHC.Show.Show Control.Monad.TimeMachine.Engine.TimeScale instance GHC.Classes.Eq Control.Monad.TimeMachine.Engine.TimeScale instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.TimeMachine.Engine.TimeMachineT m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.TimeMachine.Engine.TimeMachineT m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.TimeMachine.Engine.TimeMachineT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.TimeMachine.Engine.TimeMachineT m) instance Control.Monad.Trans.Class.MonadTrans Control.Monad.TimeMachine.Engine.TimeMachineT instance Control.Monad.TimeMachine.Engine.MonadTime GHC.Types.IO instance Control.Monad.IO.Class.MonadIO m => Control.Monad.TimeMachine.Engine.MonadTime (Control.Monad.TimeMachine.Engine.TimeMachineT m) instance GHC.Classes.Eq Control.Monad.TimeMachine.Engine.TimeInterval module Control.Monad.TimeMachine.Cockpit -- | A piese of the DSL to construct Absolute destinations. the :: UTCTime -> Destination -- | The point of time where Marty McFly arrived back from 1955 by -- DeLorean. future :: UTCTime type Hour = Int type Minute = Int type DayOfMonth = Int type Month = Int type Year = Integer -- | A piese of the DSL to construct Zoned destinations. data HalfDay am :: HalfDay pm :: HalfDay -- | A piese of the DSL to construct Zoned destinations. If the -- arguments are in the invalid ranges like jan 32 1970 am 12 -- 60, they will be clipped as jan 31 1970 am 11 59. jan :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination feb :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination mar :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination apr :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination may :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination jun :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination jul :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination aug :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination sep :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination oct :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination nov :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination dec :: DayOfMonth -> Year -> HalfDay -> Hour -> Minute -> Destination -- | A piese of the DSL to construct Relative destinations, which -- represents an unit of the interval. minutes :: Integer -> Direction -> Destination hours :: Integer -> Direction -> Destination days :: Integer -> Direction -> Destination weeks :: Integer -> Direction -> Destination months :: Integer -> Direction -> Destination years :: Integer -> Direction -> Destination -- | A piese of the DSL to construct Relative destinations. It -- represents the direction of a time travel, namely which of going -- forward or back. data Direction later :: Direction ago :: Direction -- | An alias of 1 days later. tomorrow :: Destination -- | An alias of 1 days ago. yesterday :: Destination -- | A piese of the DSL to construct Velocity acceleration. at :: NominalDiffTime -> TimeScaleUnit -> Acceleration -- | A piese of the DSL to construct Velocity acceleration. It -- represents how long it spends within the real one seconds. data TimeScaleUnit secondsPerSec :: TimeScaleUnit minutesPerSec :: TimeScaleUnit hoursPerSec :: TimeScaleUnit daysPerSec :: TimeScaleUnit -- | A piese of the DSL to construct Factor acceleration. For -- example x 60 makes the current speed of time x60 faster. x :: NominalDiffTime -> Acceleration instance GHC.Enum.Enum Control.Monad.TimeMachine.Cockpit.TimeScaleUnit instance GHC.Show.Show Control.Monad.TimeMachine.Cockpit.TimeScaleUnit instance GHC.Enum.Enum Control.Monad.TimeMachine.Cockpit.Direction instance GHC.Show.Show Control.Monad.TimeMachine.Cockpit.Direction instance GHC.Classes.Eq Control.Monad.TimeMachine.Cockpit.Direction instance GHC.Enum.Enum Control.Monad.TimeMachine.Cockpit.HalfDay instance GHC.Classes.Ord Control.Monad.TimeMachine.Cockpit.HalfDay instance GHC.Show.Show Control.Monad.TimeMachine.Cockpit.HalfDay instance GHC.Classes.Eq Control.Monad.TimeMachine.Cockpit.HalfDay instance GHC.Classes.Eq Control.Monad.TimeMachine.Cockpit.TimeScaleUnit module Control.Monad.TimeMachine