| Copyright | (c) OleksandrZhabenko 2020 |
|---|---|
| License | MIT |
| Stability | experimental |
| Safe Haskell | Safe |
| Language | Haskell2010 |
System.Extended.PrintMessage.Lazy
Contents
Description
Maintainer : olexandr543@yahoo.com
The module is intended to print updated messages on the terminal screen with lazy functions.
Synopsis
- printUpdatedMsg :: String -> [String] -> Int -> IO ()
- printUpdatedMsg2 :: String -> [String] -> [Int] -> IO ()
- endZQuotInteger :: Double -> Integer -> IO (Double, Integer)
- endZQuot :: Double -> (Double, Integer)
- phi0 :: Double
- timeIntervalsPHi0 :: Double -> [Int]
- timeIntervalsPHi0s :: Double -> [Double]
- deltaTimePHi0 :: Double -> [Int]
- deltaTimePHi0s :: Double -> [Double]
IO functions
printUpdatedMsg :: String -> [String] -> Int -> IO () Source #
Function printUpdatedMsg prints a sequence of the first String concatenated with the appropriate element of the second [String] argument
through special time interval specified by the Int argument after the pause in the Int microseconds (1/10^6 second)
(approximately, depending on the GHC generated code performance). This looks like continually updated string on the screen of the terminal. All
String arguments must not contain the special symbols '\n' and '\r' and vertical spaces. Please, check by yourself that the Int
argument does not exceed the maxBound :: Int.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
printUpdatedMsg2 :: String -> [String] -> [Int] -> IO () Source #
Function printUpdatedMsg2 works the same as the function printUpdatedMsg with the difference that time intervals are specified by the list of Ints.
The length of the lists must be equal, otherwise the function will truncate them to the less of the both ones length. Please, check by yourself that every Int
argument does not exceed the maxBound :: Int.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
endZQuotInteger :: Double -> Integer -> IO (Double, Integer) Source #
Function endZQuotInteger splits a Double argument to a less by absolute value Double specified by the Integer argument with some
regularization for the uncommon values.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
Pure functions
No 'golden ratio' inside
endZQuot :: Double -> (Double, Integer) Source #
Function endZQuot returns a tuple of numbers -- a fractional part and a whole part of the number.
Inspired by: https://mail.haskell.org/pipermail/beginners/2009-November/002814.html
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
The 'golden ratio' inside
timeIntervalsPHi0 :: Double -> [Int] Source #
Function timeIntervalsPHi0 produces a list of Ints of the time interval values for the threadDelay function.
These time interval points can create for some users an impression of the smooth convergence to the end of the time intervals.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
timeIntervalsPHi0s :: Double -> [Double] Source #
The same as timeIntervalsPHi0 function, but the result is in seconds.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
Differences functions
deltaTimePHi0 :: Double -> [Int] Source #
Function deltaTimePHi0 returns a list of Ints of the differences between the neighbour values in the list produced by the timeIntervalsPHi0 function.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.
deltaTimePHi0s :: Double -> [Double] Source #
The same as deltaTimePHi0 function, but the result is in seconds.
The function does not provide exact timing possibilities, but rather approximates timing behaviour. Do not use it as a timer for anything, but use it as an approximation in time to the desired conditions. That is so because of the laziness of Haskell and so it is rather hard to control the time moment when the code will be executed.