deemp / servant-queryparam

Use records to specify query parameters in servant APIs
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

servant-queryparam

Provides packages that let you use records to specify query parameters in servant APIs.

These packages are:

Here's an example of a server:

Background

Packages in this repo are based on the following packages:

Build

You can build all packages using cabal-install.

cabal build all

Nix flake

This repository provides a Nix flake with development tools and Nix derivations of servant-queryparam-* libraries.

Prerequisites

Spoiler - [flake.nix](./flake.nix) - code in this flake is extensively commented. - [language-tools/haskell](https://github.com/deemp/flakes/blob/main/language-tools/haskell/flake.nix) - a flake that conveniently provides `Haskell` tools. - [Conventions](https://github.com/deemp/flakes/blob/main/README/Conventions.md#dev-tools) - I recommended to use this flake just for development. For packaging an app, make another flake with a limited number of inputs to reduce the `flake.lock` size. See these for additional info: - [codium-generic](https://github.com/deemp/flakes/tree/main/templates/codium/generic#readme) - info just about `VSCodium` with extensions. - [codium-haskell](https://github.com/deemp/flakes/tree/main/templates/codium/haskell#readme) - an advanced version of this flake. - Shows how to build a static binary from your package and how to make a Docker image with it. - [Haskell](https://github.com/deemp/flakes/blob/main/README/Haskell.md) - general info about `Haskell` tools. - [Troubleshooting](https://github.com/deemp/flakes/blob/main/README/Troubleshooting.md) - [Prerequisites](https://github.com/deemp/flakes#prerequisites) - [Nixpkgs support for incremental Haskell builds](https://www.haskellforall.com/2022/12/nixpkgs-support-for-incremental-haskell.html) - [flakes](https://github.com/deemp/flakes#readme) - my Nix flakes that may be useful for you.

Quick start

  1. Install Nix - see how.

  2. In a new terminal, start a devshell and build all packages.

    nix develop
    cabal build all
  3. (Optionally) Write settings.json and start VSCodium.

    nix run .#writeSettings
    nix run .#codium .
  4. (Optionally) Open a Haskell file and hover over a function.

  5. (Optionally) Wait until Haskell Language Server (HLS) starts giving you type info.

Configs