some more documentation, code cleanup + changelog entry
This commit is contained in:
parent
6909b54367
commit
7a83952bad
2 changed files with 8 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
0.3
|
||||
---
|
||||
* Add a `Canonicalize` type family that distributes all `:>`s inside `:<|>`s to get to the canonical type of an API -- which is then used in all other packages to avoid weird handler types in *servant-server*.
|
||||
* Multiple content-type/accept support for all the relevant combinators
|
||||
* Provide *JSON*, *PlainText*, *OctetStream* and *FormUrlEncoded* content types out of the box
|
||||
* Type-safe link generation to API endpoints
|
||||
|
|
|
@ -80,7 +80,12 @@ import Servant.Utils.Links (HasLink (..), IsElem, IsElem',
|
|||
|
||||
-- | Turn an API type into its canonical form.
|
||||
--
|
||||
-- The canonical form is defined and will basically turn:
|
||||
-- The canonical form of an API type is basically the all-flattened form
|
||||
-- of the original type. More formally, it takes a type as input and hands you
|
||||
-- back an /equivalent/ type formed of toplevel `:<|>`-separated chains of `:>`s,
|
||||
-- i.e with all `:>`s distributed inside the `:<|>`s.
|
||||
--
|
||||
-- It basically turns:
|
||||
--
|
||||
-- > "hello" :> (Get Hello :<|> ReqBody Hello :> Put Hello)
|
||||
--
|
||||
|
@ -101,5 +106,5 @@ type family Redex a b c :: * where
|
|||
Redex a a first = Canonicalize first :> a
|
||||
Redex a b first = Canonicalize (first :> b)
|
||||
|
||||
canonicalize :: Canonicalize layout ~ t => Proxy layout -> Proxy t
|
||||
canonicalize :: Proxy layout -> Proxy (Canonicalize layout)
|
||||
canonicalize Proxy = Proxy
|
||||
|
|
Loading…
Reference in a new issue