Translate servant API to purescript code, with the help of purescript-bridge.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples/central-counter
src/Servant
test
.gitignore
.travis.yml
LICENSE
Readme.md
Setup.hs
devEnv.sh
packages.nix
servant-purescript.cabal
stack-7.10.yaml
stack-8.0.nix
stack-8.0.yaml
stack.nix

Readme.md

Servant Purescript

Build Status

Generate typed PureScript query functions for your servant-api. Find an example, including the generated code in examples/central-counter.

Features

  • Typed serialization/deserialization, taken care of by Haskell's aeson and PureScript's argonaut. Generic encoding/decoding of both made compatible by purescript-argonaut-generic-codecs.
  • You can put common parameters like Auth tokens and the base URL in a reader monad, so you don't have to pass them explicitly. This is configurable in the code generator with readerParams in Settings.

Usage

Apart from the above basic usage example, the documentation is still lacking. For the purescript side make sure you have purescript-servant-support and purescript-argonaut-generic-codecs installed, otherwise the generated code will not compile.

Status

It works!

Documentation is yet to come, but there is a usage example in examples/central-counter which also uses servant-subscriber for counter live updates. Generated code is only partly tested, especially Query parameters are still completely untested.

For type translations purescript-bridge is used.