o-clock-1.0.0: Type-safe time library.

Safe HaskellNone
LanguageHaskell2010

Time.Rational

Description

This module introduces Rat kind and all necessary functional.

Synopsis

Documentation

data Rat Source #

Data structure represents the rational number. Rational number can be represented as a pair of natural numbers n and m where m is nor equal to zero.

Constructors

Nat ::% Nat 

Instances

SeriesP ([] Rat) Source # 

Methods

seriesP :: KnownRatName someUnit => String -> Maybe (Time someUnit) Source #

SeriesF ([] Rat) Source # 

Methods

seriesF :: KnownRatName someUnit => Time someUnit -> String Source #

(KnownRatName unit, SeriesP ((:) Rat nextUnit units)) => SeriesP ((:) Rat unit ((:) Rat nextUnit units)) Source # 

Methods

seriesP :: KnownRatName someUnit => String -> Maybe (Time someUnit) Source #

KnownRatName unit => SeriesP ((:) Rat unit ([] Rat)) Source # 

Methods

seriesP :: KnownRatName someUnit => String -> Maybe (Time someUnit) Source #

(KnownRatName unit, SeriesF ((:) Rat nextUnit units)) => SeriesF ((:) Rat unit ((:) Rat nextUnit units)) Source # 

Methods

seriesF :: KnownRatName someUnit => Time someUnit -> String Source #

KnownRatName unit => SeriesF ((:) Rat unit ([] Rat)) Source # 

Methods

seriesF :: KnownRatName someUnit => Time someUnit -> String Source #

type DivK Nat Rat Source # 
type DivK Nat Rat = Rat
type DivK Rat Nat Source # 
type DivK Rat Nat = Rat
type DivK Rat Rat Source # 
type DivK Rat Rat = Rat
type MulK Nat Rat Source # 
type MulK Nat Rat = Rat
type MulK Rat Nat Source # 
type MulK Rat Nat = Rat
type MulK Rat Rat Source # 
type MulK Rat Rat = Rat

type (:%) = (::%) Source #

More convenient name for promoted constructor of Rat.

type family MulK (k1 :: Type) (k2 :: Type) :: Type Source #

The result kind of overloaded multiplication.

Instances

type MulK Nat Nat Source # 
type MulK Nat Nat = Nat
type MulK Nat Rat Source # 
type MulK Nat Rat = Rat
type MulK Rat Nat Source # 
type MulK Rat Nat = Rat
type MulK Rat Rat Source # 
type MulK Rat Rat = Rat

type family DivK (k1 :: Type) (k2 :: Type) :: Type Source #

The result kind of overloaded division.

Instances

type DivK Nat Nat Source # 
type DivK Nat Nat = Rat
type DivK Nat Rat Source # 
type DivK Nat Rat = Rat
type DivK Rat Nat Source # 
type DivK Rat Nat = Rat
type DivK Rat Rat Source # 
type DivK Rat Rat = Rat

type RatioNat = Ratio Natural Source #

Rational numbers, with numerator and denominator of Natural type.

class KnownRat (r :: Rat) where Source #

This class gives the integer associated with a type-level rational.

Minimal complete definition

ratVal

Instances

type KnownDivRat a b = (KnownRat a, KnownRat b) Source #

Constraint alias for DivRat units.