MyNixOS website logo
Description

Parser and interpreter of OpenStreetMap conditional restriction values.

Conditional Restriction Parser

This project includes a library that can be used to handle 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).

Metadata

Version

0.1.0.5

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows