The time-interval package

[Tags:library, public-domain]

Two common ways to represent and hold short time intervals seem to be:

1. Hold time in microseconds as an Int or Integer

2. Use time units abstraction, e.g. see the time-units package

While the second option is a great abstraction to use in APIs, it works for datatypes a bit less well than for function types. That's because a datatype which a Data.Time.Units.TimeUnit field suddenly becomes polymorphic over that field, and all function type signatures involving that datatype need to be updated. This is less an issue for functions, because you don't specify the type of every function at the call site.

Perhaps there is a solution for that which involves datatype related language extensions, but this package tries to offer a simple clean solution as follows. You store time in your datatype as an integer, but it is wrapped by an opaque Data.Time.Interval.TimeInterval type. You then get the best of both worlds:

The time type can be equally used to represent time intervals, time durations and generally time lengths. But since high precision is used (microseconds), you'll probably want this library for short time lengths (at most seconds, minutes, hours). For calendar based and related time functions and types, see the time package.

[Skip to Readme]


Versions, 0.1.1
Change log ChangeLog
Dependencies base (>=4.7 && <5), time-units [details]
License PublicDomain
Copyright ♡ Copying is an act of love. Please copy, reuse and share.
Author fr33domlover
Category Data
Home page
Bug tracker
Source repository head: darcs get
Uploaded Mon May 30 06:56:54 UTC 2016 by akrasner
Distributions NixOS:0.1.1
Downloads 189 total (15 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2016-05-30 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for time-interval

Readme for time-interval-0.1.1

See the .cabal file for more info and link to project website the version control.

The official download location is Hackage:

This library is free software, and is committed to software freedom. It is released to the public domain using the CC0 Public Domain Dedication. For the boring "legal" details see the file 'COPYING'.

See the file 'INSTALL' for hints on installation. The file 'ChangeLog' explains how to see the history log of the changes done in the code. 'NEWS' provides a friendly overview of the changes for each release.