allen: A monadic way of calculating relations between intervals of time.

[ algebra, bsd3, library, program ] [ Propose Tags ]

Please see the README on GitHub at

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS]
Change log
Dependencies aeson (>=2.1.2 && <2.2), allen, base (>=4.7 && <5), bytestring (>= && <0.12), containers (>=0.6.4 && <0.7), mtl (>=2.2.2 && <2.3), text (>=2.0.2 && <2.0.3), vector (>=0.13.0 && <0.14) [details]
License BSD-3-Clause
Copyright 2023 Adam Brohl
Author Adam Brohl
Category Algebra
Home page
Bug tracker
Source repo head: git clone
Uploaded by archaversine at 2023-09-06T15:41:35Z
Executables allen-calculator
Downloads 46 total (8 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-09-06 [all 1 reports]

Readme for allen-

[back to package description]

Haskell - Allen's Interval Algebra Implementation

An Implementation of Allen's Interval Algebra in Haskell.

This library provides a monadic way to perform computations related to Allen's interval algebra. The interval network strucutre is implicitly updated upon the creation of a new interval and when a set of relations is applied to two intervals.


This library is based off of the interval algebra described in Maintaining Knowledge about Temporal Intervals, and Allen's Interval Algebra.


Assume a situation with three intervals:

  1. I am walking.
  2. I am talking.
  3. My friend calls me.

and assume that we know the following:

  • When I am walking, I am not talking.
  • When my friend called me, I started talking.

we can easily compute the relations between when I was walking and when my friend called me:

calc :: Allen [Relation]
calc = do 
    walking <- interval 
    talking <- interval 
    friend  <- interval

    assumeSet walking [Precedes, Meets, MetBy, PrecededBy] talking
    assume friend Starts talking

    relations <- getConstraints walking friend

    return (fromBits relations)

main :: IO ()
main = print $ evalAllen calc

And this gives the result:


Which means that we can deduce that walking either happens before, directly before, or after my friend calls.


To view more information for library functions, you can view the documentation for this library here.

Interactive REPL

You can use an interactive REPL to perform calculations from the command line. Executables are available for both Linux and Windows.

You can download the interactive version here: