fuzzytime-0.7.8: A 'ten past six' style clock

Safe HaskellSafe
LanguageHaskell98

FuzzyTime

Description

In this module the actual conversion from time to string happens.

There are two modes, showing the time and showing the time left till something. This is represented by the duality of both FuzzyTimeConf and FuzzyTime: ClockConf and FuzzyClock serve to show the time, while TimerConf and FuzzyTimer are used for counting down.

A FuzzyTime is created from a FuzzyTimeConf with toFuzzyTime. It is translated to a string via show.

Apart from the above, two functions are exported: isTimerZero which can be used by an interface to set off the alarm when timer reaches zero, and nextFTHour which makes sure that the clock is a circular data structure.

Synopsis

Documentation

data FuzzyTime Source #

Data for fuzzified time. There are two modes: FuzzyClock for showing what time it is and FuzzyTimer for showing how much time there is left till something. The String output is obtained via Show.

Constructors

FuzzyClock 

Fields

FuzzyTimer 

Fields

Instances

Eq FuzzyTime Source # 
Show FuzzyTime Source #

This is where FuzzyTime is turned into the time String. It is assumed that by the time these functions are called, hour will be in [0..23] and min will be in [0..59].

capsizeDef :: Int -> String -> String Source #

Capitalizes the string in one of the four ways: 0. all small; 1. default; 2. sentence case; 3. all caps

toFuzzyTime :: FuzzyTimeConf -> FuzzyTime Source #

Turns a FuzzyTimeConf into a FuzzyTime. Works for both FuzzyClock and FuzzyTimer. In the clock mode, am (Bool), clock (12 vs. 24-hour), language and style are set apart from the actual time, so that show knows how to display the time. In the timer mode, only language and left minutes need to be set.

isTimerZero :: FuzzyTime -> Bool Source #

Reports whether timer is now at zero. (Needed for the interface to know when to play a sound.)

nextFTHour :: FuzzyTime -> Int Source #

Makes sure that noon is always represented as 0, and midnight – always as 0 or 24 (depending on the clock).

data FuzzyTimeConf Source #

Data for CmdArgs. Has the two modes of module FuzzyTime: showing the current time and showing the time left. Note that this is not the same as the two modes of module Main.

Constructors

ClockConf 

Fields

TimerConf 

Fields

Instances

Data FuzzyTimeConf Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FuzzyTimeConf -> c FuzzyTimeConf #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FuzzyTimeConf #

toConstr :: FuzzyTimeConf -> Constr #

dataTypeOf :: FuzzyTimeConf -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c FuzzyTimeConf) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FuzzyTimeConf) #

gmapT :: (forall b. Data b => b -> b) -> FuzzyTimeConf -> FuzzyTimeConf #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FuzzyTimeConf -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FuzzyTimeConf -> r #

gmapQ :: (forall d. Data d => d -> u) -> FuzzyTimeConf -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FuzzyTimeConf -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FuzzyTimeConf -> m FuzzyTimeConf #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FuzzyTimeConf -> m FuzzyTimeConf #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FuzzyTimeConf -> m FuzzyTimeConf #

Show FuzzyTimeConf Source # 

type Time = String Source #

Convenience alias.