servant-flatten: Utilities for flattening servant API types

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Utilities for flattening servant API types

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


[Skip to Readme]

Properties

Versions 0.1, 0.2, 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 2018-03-19T16:51:50Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

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.