servant-flatten: Utilities for flattening servant API types

[ bsd3, library, web ] [ Propose Tags ]

Utilities for flattening servant API types

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


[Skip to Readme]
Versions [faq] 0.1, 0.2
Change log ChangeLog.md
Dependencies base (>=4.8 && <5), servant (>=0.8) [details]
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 Mon Mar 19 16:52:44 UTC 2018
Distributions NixOS:0.2
Downloads 278 total (22 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-03-19 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


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.