https://github.com/mbg/time-units-types
Type-level representations of time periods
https://github.com/mbg/time-units-types
Last synced: about 2 months ago
JSON representation
Type-level representations of time periods
- Host: GitHub
- URL: https://github.com/mbg/time-units-types
- Owner: mbg
- License: mit
- Created: 2022-03-30T11:48:11.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-24T20:49:44.000Z (about 1 year ago)
- Last Synced: 2024-04-25T04:20:48.782Z (about 1 year ago)
- Language: Haskell
- Size: 47.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# time-units-types


[](https://hackage.haskell.org/package/time-units-types)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`](https://hackage.haskell.org/package/time-units) library.
```haskell
{-# 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:
- [`time-units`](https://hackage.haskell.org/package/time-units)
- [`o-clock`](https://hackage.haskell.org/package/o-clock)