Safe Haskell | Safe |
---|---|
Language | Haskell98 |
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
- capsizeDef :: Int -> String -> String
- toFuzzyTime :: FuzzyTimeConf -> FuzzyTime
- isTimerZero :: FuzzyTime -> Bool
- nextFTHour :: FuzzyTime -> Int
- data FuzzyTimeConf
- type Time = String
Documentation
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.
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.