Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.19 KB

README.md

File metadata and controls

44 lines (29 loc) · 1.19 KB

Rampart

Determine how intervals relate to each other.

rampart.scala is a Scala implementation of tfausak/rampart, as Haskell library, which in turn was inspired by James F. Allen's, Maintaining Knowledge About Temporal Intervals.

The original project and this implementation use the terminology from that report.

It currently has a dependency on cats, specifically it's Order typeclass.

Usage

Dependencies in your build.sbt

resolvers += Resolver.bintrayRepo("oschrenk", "maven")
libraryDependencies += "dev.oschrenk" %% "rampart-scala" % "0.2.0"

Example

  import Interval.{relate, toInterval}
  import cats.implicits._

  val a = toInterval(1, 2)
  val b = toInterval(3, 7)
  relate(a, b) match {
    case Relation.Before => println("Before")
    case _      => throw new IllegalArgumentException("What is this?")
  }

Terminology

Publish

sbt publish