timeline: Data type representing a piecewise-constant function over time

[ bsd3, development, library ] [ Propose Tags ]

Provides data types and related function to make handling timelines easier. Please see the README on GitHub at https://github.com/bellroy/timeline

[Skip to Readme]


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS]
Change log CHANGELOG.md
Dependencies base (>=4.14.3 && <4.20), containers (>=0.6.5 && <0.7.1), hedgehog (>=1.1 && <1.5), indexed-traversable (>=0.1.2 && <0.2), semigroupoids (>=5.3.7 && <6.1), template-haskell (>=2.16.0 && <2.22), text (>= && <1.3 || >=2.0 && <2.1.1), th-compat (>=0.1.4 && <0.2), time (>=1.9.3 && <1.13) [details]
License BSD-3-Clause
Author Bellroy Tech Team <haskell@bellroy.com>
Maintainer Bellroy Tech Team <haskell@bellroy.com>
Revised Revision 5 made by HughDavidson at 2023-12-12T04:58:35Z
Category Development
Source repo head: git clone https://github.com/bellroy/timeline.git
Uploaded by kokobd at 2023-03-17T01:13:06Z
Distributions NixOS:
Downloads 70 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-03-17 [all 1 reports]

Readme for timeline-

[back to package description]



The world is always changing, and often we want to manage the changes of data using computers. Below are some concrete examples:

  • Employee data such as compensation, city, tax rule, time-off, etc.
  • Prices of products. A product could have different prices on Amazon and EBay, and in different currencies.

Timeline data is often implemented by attaching extra fields to your business object, denoting the start and end time of each interval. However, only representing and storing the data is not sufficient, we need to run operations on timeline data, like extracting a single data point at some specific time, merging multiple timelines together, etc.

If you have a similar use case and don't want to reinvent the wheel, this library is for you.

Module Organization

  • Data.Timeline essential types and functions
  • Data.Timeline.Hedgehog hedgehog generators for timeline types

Getting Started

The core type is Timeline a, refer to Haddock for its usage.


Bellroy actively maintains this project. Feel free to submit issues and pull requests!

The code is formatted with ormolu

If you use Nix:

  • nix develop enter a shell with all necessary tools
  • nix build build and run tests on all GHC versions we support
  • Use nix flake show to view a full list of outputs