time-units-types: Type-level representations of time durations.

[ data, library, mit ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/mbg/time-units-types#readme

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],,
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), time-units [details]
License MIT
Copyright 2022 Michael B. Gale
Author Michael B. Gale
Maintainer github@michael-gale.co.uk
Category Data
Home page https://github.com/mbg/time-units-types#readme
Bug tracker https://github.com/mbg/time-units-types/issues
Source repo head: git clone https://github.com/mbg/time-units-types
Uploaded by mbg at 2022-03-30T14:28:32Z
Distributions LTSHaskell:, NixOS:, Stackage:
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 307 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-03-30 [all 1 reports]

Readme for time-units-types-

[back to package description]


MIT Build Hackage

This Haskell library exports types which can be used to describe simple type periods at the type-level. The type-level descriptions can then be reifed to corresponding values of the time-units library.

{-# LANGUAGE TypeApplications #-}

import Data.Time.TypeLevel

type TenSeconds = 'Second 10

main :: IO ()
main = do
    -- `durationVal` converts the type-level specification to a corresponding
    -- value from "Data.Time.Units"
    print $ durationVal @TenSeconds
    -- `durationMicroseconds` converts the type-level specification to a
    -- corresponding integer value, representing microseconds
    print $ durationMicroseconds @TenSeconds

See the Haddock documentation for a reference of all supported units.

See also

Related/similar projects: