servant-serf: Automatically generate Servant API modules.

[ library, mit, program, web ] [ Propose Tags ] [ Report a vulnerability ]

servant-serf

servant-serf is a preprocessor for GHC that automatically generates Servant API modules. It is similar to the hspec-discover package.

Example input

{-# OPTIONS_GHC -F -pgmF servant-serf #-}

Example output

{-# LINE 1 "Example.hs" #-}
{-# OPTIONS_GHC -w #-}

module Example where

import qualified Servant

import qualified Example.One
import qualified Example.Two

type API
  = Example.One.API
  Servant.:<|> Example.Two.API

server
  = Example.One.server
  Servant.:<|> Example.Two.server

Options

To pass options into servant-serf, use -optF. For example:

{-# OPTIONS_GHC -F -pgmF servant-serf -optF --depth=shallow #-}
  • --module-name=STRING: Sets the name to use for the generated module. By default this is determined from the source file path. For example src/X.hs would use the module name X.

  • --depth=deep|shallow: Controls whether to search through only one dierctory (shallow) or recursively (deep). Defaults to deep.

  • --api-name=STRING: Sets the name to use for the API type. Defaults to API. Note that the same name is used for both referenced API types and the generated API type.

  • --server-name=STRING: Sets the name to use for the server value. Defaults to server. Note that the same name is used for both referenced server values and the generated server value.

Notes

  • The input module is completely ignored.

  • Modules are sorted by name. There is no way to customize how they are sorted.

  • All modules below the current module are included. There is no way to customize which modules are included or excluded.

  • The generated server value does not have a type signature. It should have type Servant.ServerT API m for some m, but that m can change and is easily inferred by GHC.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
pedantic

Enables -Werror, which turns warnings into errors.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.3.0.1, 0.3.1.0, 0.3.1.1, 0.3.1.2, 0.3.1.3, 0.3.1.4, 0.3.1.5, 0.3.1.6 (info)
Change log CHANGELOG.markdown
Dependencies base (>=4.15.0 && <4.20), Cabal-syntax (>=3.6.0 && <3.11), directory (>=1.3.6 && <1.4), exceptions (>=0.10.4 && <0.11), filepath (>=1.4.2 && <1.5), servant-serf [details]
License MIT
Author
Maintainer ACI Learning
Category Web
Source repo head: git clone https://github.com/acilearning/servant-serf
Uploaded by fozworth at 2024-01-24T17:10:26Z
Distributions NixOS:0.3.1.6
Executables servant-serf
Downloads 1796 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-01-24 [all 1 reports]

Readme for servant-serf-0.3.1.6

[back to package description]