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

Safe HaskellNone
LanguageHaskell2010

Time.Rational

Description

This module introduces Rat kind and all necessary functional.

Synopsis

Documentation

data Rat #

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) # 

Methods

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

SeriesF ([] Rat) # 

Methods

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

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

Methods

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

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

Methods

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

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

Methods

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

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

Methods

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

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

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

More convenient name for promoted constructor of Rat.

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

The result kind of overloaded multiplication.

Instances

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

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

The result kind of overloaded division.

Instances

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

type RatioNat = Ratio Natural #

Rational numbers, with numerator and denominator of Natural type.

class KnownRat (r :: Rat) where #

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

Minimal complete definition

ratVal

Methods

ratVal :: RatioNat #

Instances

(KnownNat a, KnownNat b) => KnownRat ((:%) a b) # 

Methods

ratVal :: RatioNat #

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

Constraint alias for DivRat units.