Popularity
5.3
Growing
Activity
0.0
Stable
10
2
0

Monthly Downloads: 74
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Web     Servant    
Latest version: v0.2

servant-flatten alternatives and similar packages

Based on the "servant" category

Do you think we are missing an alternative of servant-flatten or a related project?

Add another 'servant' Package

README

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.API.Flatten for more.