scalendar: Time-Management in Haskell
Many things in business require time-management of a set of resources. For example, in a hotel you can book different types of rooms, a company might rent an office in a business center, or you might want to rent a specific car from a car rental business. In all these examples you might want to book a resource for several days, let's say, you plan to book a hotel room in Beverly Hills from July 9th to July 20th and perhaps when you are there you plan to rent a Ferrari for some days. More generally, our business model may have some sort of resource which can be booked for a number of days and once it's booked it's no longer available to other users for that period of time.
Naturally, when we are given a set of available resources for a given business, we want to know how many units are available for a given check-in (starting date) and check-out (end-date). By availability we mean that there are no conflicts between a desired reservation and previous reservations which have been made on a specific resource over a period of time. Also, not only we want to know the quantity of the available units, but additionally we want to know a set of identifiers of the units which are still available. For example, for the owner of a car rental it would be very useful to know with anticipation that from July 9th to July 20th she still has a Ferrari Dino, a Ferrari California and a Lamborghini Aventador available for you to rent.
This is the kind of problem that scalendar approaches - namely, managing availability over time for a set of identifiers (which represent resources), where the availability varies according to the state of a calendar that is affected by the history of reservations previously performed.
If you search the Internet for time management systems, you may have a hard time finding something similar. Most examples out there focus on the front-end: showing the calendar, but not on the backend: managing valid reservations in your business logic. Most of time-management software which could be reliable is proprietary. In contrast, scalendar is an open-source solution that serves as a proxy between your storage system and your business model. That way you have complete control over how you are storing reservations, and your back-end is properly decoupled from the GUI.
So if you are planning to build an application which needs time management, give scalendar a try! In case you have gone through the README but still are not very clear about how to integrate this library with your application, take a look at our minimalistic example which is about a simple API in servant to know the availability of rooms in a hotel.
Finally, we want to acknowledge Martin Rayrole, who is the author of the "Top-Nodes" algorithm on which the scalendar library is based: without his ideas it would have been harder to figure out a time management library in Haskell. You can verify in the
Abandonment section of this web-page that the version of the algorithm which inspired this library now belongs to the public domain.