Safe Haskell | None |
---|

# Documentation

class HasSeconds t whereSource

modSeconds :: Double -> SecondsSource

Construct seconds such that if the given value is out of bounds, a modulus is taken to keep it within 0 inclusive and 60 exclusive.

`>>>`

Seconds 7.0000`modSeconds 7`

`>>>`

Seconds 0.0000`modSeconds 0`

`>>>`

Seconds 59.9999`modSeconds (-0.0001)`

`>>>`

Seconds 0.0000`modSeconds 60`

`>>>`

Seconds 60.0000`modSeconds 59.99999`

`>>>`

Seconds 59.9990`modSeconds 59.999`

nSeconds :: Prism' Double SecondsSource

A prism on seconds to a double between 0 inclusive and 60 exclusive.

`>>>`

Just (Seconds 7.0000)`7 ^? nSeconds`

`>>>`

Just (Seconds 0.0000)`0 ^? nSeconds`

`>>>`

Just (Seconds 59.0000)`59 ^? nSeconds`

`>>>`

Just (Seconds 59.9900)`59.99 ^? nSeconds`

`>>>`

Nothing`60 ^? nSeconds`

all (\m -> nSeconds # m == n) (n ^? nSeconds)