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

Copyright (c) Ryota Kameoka 2018 BSD-3 kameoka.ryota@gmail.com experimental Safe Haskell2010

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

Methods

Instances

 Source # Caution: the fractional part will be rounded. Methods Source # Caution: the fractional part will be rounded. Methods Source # Methods Source # Methods

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

 Source # Methods Source # Methods Source # Caution: the fractional part will be rounded. Methods Source # Caution: the fractional part will be rounded. Methods Source # Caution: the fractional part will be rounded. Methods Source # Caution: the fractional part will be rounded. Methods Source # Caution: the fractional part will be rounded. Methods Source # Caution: the fractional part will be rounded. Methods Source # Methods Source # Caution: the fractional part will be rounded. Methods

# 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

 Source # Methodslift :: Time -> Q Exp #