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

Safe HaskellSafe-Infered



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.



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.




ftAm :: Bool
ftCaps :: Int
ftClock :: Int
ftHour :: Int
ftLang :: String
ftMin :: Int
ftStyle :: Int


ftLang :: String
ftMins :: Int


Eq FuzzyTime 
Show FuzzyTime

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 -> StringSource

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

toFuzzyTime :: FuzzyTimeConf -> FuzzyTimeSource

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 -> BoolSource

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

nextFTHour :: FuzzyTime -> IntSource

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.




caps :: Int
clock :: Int
lang :: String
prec :: Int
time :: Time
sound :: String
style :: Int


end :: Time
lang :: String
now :: Time

type Time = StringSource

Convenience alias.