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

[ data, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

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


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1
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:0.2.0.1, NixOS:0.2.0.1, Stackage:0.2.0.1
Reverse Dependencies 1 direct, 3 indirect [details]
Downloads 486 total (12 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-0.2.0.1

[back to package description]

time-units-types

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: