servant-flatten: Utilities for flattening servant API types

[ bsd3, library, web ] [ Propose Tags ] [ Report a vulnerability ]

Utilities for flattening servant API types

See the documentation of Servant.API.Flatten.flatten.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.2
Change log ChangeLog.md
Dependencies base (>=4.8 && <5), servant (>=0.8) [details]
Tested with ghc ==8.0.2, ghc ==8.2.2
License BSD-3-Clause
Copyright 2018 Alp Mestanogullari, Julian Arni
Author Alp Mestanogullari
Maintainer alpmestan@gmail.com
Category Web
Home page https://github.com/alpmestan/servant-flatten
Bug tracker http://github.com/alpmestan/servant-flatten/issues
Source repo head: git clone https://github.com/alpmestan/servant-flatten.git
Uploaded by AlpMestanogullari at 2018-03-19T16:52:44Z
Distributions NixOS:0.2
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 2652 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-03-19 [all 1 reports]

Readme for servant-flatten-0.2

[back to package description]

servant-flatten

Utilities for flattening servant API types

The main function from this library is:

flatten :: Proxy api -> Proxy (Flat api)

Its purpose is to "flatten" an API type, by distributing any factored combinators, so as to end up with completely flat endpoint descriptions, separated by :<|>s.

For example, it turns:

type API = Capture "foo" Int :>
  ( Capture "bar" String :>
      ( Get '[JSON] String :<|>
        ReqBody '[JSON] Int :> Post '[JSON] Int
      ) :<|>
    Get '[JSON] Int
  ) :<|>
  Get '[JSON] [String]

into:

Capture "foo" Int :> Capture "bar" String :> Get '[JSON] String :<|>
Capture "foo" Int :> Capture "bar" String :> ReqBody '[JSON] Int :> Post '[JSON] Int :<|>
Capture "foo" Int :> Get '[JSON] Int :<|>
Get '[JSON] [String]

See the documentation of flatten in Servant.Flatten for more.