duration-0.1.0.0: A tiny compile-time time utility library inspired by zeit/ms

Copyright(c) Ryota Kameoka 2018
LicenseBSD-3
Maintainerkameoka.ryota@gmail.com
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Data.Time.Clock.Duration.Types

Contents

Description

This module exports internally used type classes and data types. You can extend this package's functionality by utilizing them.

Synopsis

Type classes

class AbsoluteDuration a where Source #

The AbsoluteDuration class provides how to convert the given Time into a specific unit of time. An instance should represent a quantity with the dimension of T.

42 seconds in DiffTime (seconds):

>>> [t| 42s |] :: DiffTime
42s

42 seconds in CUSeconds (microseconds):

>>> [t| 42s |] :: CUSeconds
42000000

Minimal complete definition

toAbsoluteDuration

class RelativeDuration a where Source #

The RelativeDuration class represents how to calculate how long the given Time is when measured in a specific unit of time. An instance should represent a quantity with the dimension of 1.

42 minutes in seconds:

>>> [s| 42m |] :: Int
2520

3 seconds in microseconds:

>>> [µs| 3s |] :: Int
3000000

Minimal complete definition

toRelativeDuration

Instances

RelativeDuration Double Source # 
RelativeDuration Float Source # 
RelativeDuration Int Source #

Caution: the fractional part will be rounded.

RelativeDuration Int8 Source #

Caution: the fractional part will be rounded.

RelativeDuration Int16 Source #

Caution: the fractional part will be rounded.

RelativeDuration Int32 Source #

Caution: the fractional part will be rounded.

RelativeDuration Int64 Source #

Caution: the fractional part will be rounded.

RelativeDuration Integer Source #

Caution: the fractional part will be rounded.

Integral a => RelativeDuration (Ratio a) Source # 
HasResolution a => RelativeDuration (Fixed a) Source #

Caution: the fractional part will be rounded.

Data types

data Time Source #

The parsing result of a string inside a quasiquoter.

Constructors

Picosec Rational 
Nanosec Rational 
Microsec Rational 
Millisec Rational

Denoted by ms, msec, msecs, millisecond, or milliseconds

Second Rational

Denoted by s, sec, secs, second, or seconds

Minute Rational

Denoted by m, min, mins, minute, or minutes

Hour Rational

Denoted by h, hr, hrs, hour, or hours

Day Rational

Denoted by d, day, or days

Week Rational

Denoted by w, week, or weeks

Year Rational

Denoted by y, yr, yrs, year, or years

Instances

Lift Time Source # 

Methods

lift :: Time -> Q Exp #