Skip to content

geometalab/conditional-restriction-parser

Repository files navigation

Conditional Restriction Parser

This project includes a library that can be used to handle OpenStreetMap (OSM) Conditional Restrictions as well as a console-based application that can be used for simple parsing and evaluation of conditional restrictions.

Both the library and the application are implemented in Haskell, using Stack. You can find the library code under src/ and the application code under app/.

The library is designed to work with conditional restrictions as documented on 14. April 2022 on the OSM Wiki. Conditional restrictions also support OSM Opening Hours, for which only a subset has been implemented in this project. The versions used are Key:opening_hours on 10. April 2022 and Key:opening_hours/specification on 04. November 2021.

Compiling the project

To compile the current state of the project, you'll need a working Stack setup and a working GHC setup. The easiest way to set those both up is probably with the GHCup tool.

Following versions have been found to be working for this project:

  • GHCup v0.1.17.7 (newer probably possible)
  • Stack v2.7.5 (newer probably possible)
  • GHC v9.0.2 (should match your installation)

The build has only been tested on (Manjaro) Linux, but other operating systems should work, as long as this setup is present. All you need to do in order to compile the library and the application is to execute

stack build

on a shell of your choice (Stack needs to be in your $PATH) in the project folder. Stack will output something like this:

Installing library in /home/user/workspace/conditional-restriction-parser/.stack-work/install/x86_64-linux-tinfo6/577aef19c282e0a36f2ce11fb38f5391ea06983467b015a6bfb319f9dd99acfe/9.0.2/lib/x86_64-linux-ghc-9.0.2/conditional-restriction-parser-0.1.0-45ZsUYVvY6oL6ghNWUuJIJ
Installing executable conditional-restriction-parser-exe in /home/user/workspace/conditional-restriction-parser/.stack-work/install/x86_64-linux-tinfo6/577aef19c282e0a36f2ce11fb38f5391ea06983467b015a6bfb319f9dd99acfe/9.0.2/bin
Registering library for conditional-restriction-parser-0.1.0..

From which you can see where the built library and where the built application was stored. If you want to install the application in your $PATH, you can execute

stack install

which will install the built application in a dedicated directory. The executable will be named conditional-restriction-parser-exe.

Developer Setup

If you want to develop new features or fix a bug, you'll need to set up a developement environment. First, follow the steps for compiling the project. Any IDE that supports Haskell works, but this project has been developed with Doom Emacs, LSP and HLS version 1.6.1.0. Please use Ormolu for formatting your code if you want to contribute your code to the project, this will guarantee consistent style.

Execute unit tests and integration tests using

stack test

in the project folder. If you want to check the test coverage, use

stack test --coverage
stack hpc report .

License

This project is licensed under AGPL version 3 (only).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published