servant 0.17 → 0.18
raw patch · 6 files changed
+194/−17 lines, 6 filesdep ~QuickCheckdep ~aesondep ~basenew-uploader
Dependency ranges changed: QuickCheck, aeson, base
Files
- CHANGELOG.md +25/−5
- servant.cabal +9/−7
- src/Servant/API/Header.hs +1/−1
- src/Servant/API/ResponseHeaders.hs +1/−1
- src/Servant/API/Status.hs +155/−0
- src/Servant/Links.hs +3/−3
CHANGELOG.md view
@@ -1,5 +1,25 @@ [The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md) +0.18+----++### Significant changes++- Support for ghc8.8 (#1318, #1326, #1327)++- Configurable error messages for automatic errors thrown by servant,+ like "no route" or "could not parse json body" (#1312, #1326, #1327)++### Other changes++- Witness that a type-level natural number corresponds to a HTTP+ status code (#1310)++- Improve haddocs (#1279)++- Dependency management (#1269, #1293, #1286, #1287)++ 0.17 ---- @@ -41,7 +61,7 @@ Some APIs need query parameters rewriting, e.g. in order to support for multiple casing (camel, snake, etc) or something to that effect. - This could be easily achieved by using WAI Middleware and modyfing+ This could be easily achieved by using WAI Middleware and modifying request's `Query`. But QueryParam, QueryParams and QueryFlag use `rawQueryString`. By using `queryString` rather then `rawQueryString` we can enable such rewritings.@@ -50,10 +70,10 @@ We used `build-type: Custom`, but it's problematic e.g. for cross-compiling. The benefit is small, as the doctests- can be run other ways too (though not so conviniently).+ can be run other ways too (though not so conveniently). - *servant* Remove deprecated modules [1268#](https://github.com/haskell-servant/servant/pull/1268)- + - `Servant.Utils.Links` is `Servant.Links` - `Servant.API.Internal.Test.ComprehensiveAPI` is `Servant.Test.ComprehensiveAPI` @@ -405,7 +425,7 @@ - *servant-client-core* Add `hoistClient` to `HasClient`. Just like `hoistServer` allows us to change the monad in which request handlers- of a web application live in, we also have `hoistClient` for changing the monad+ of a web application live, we also have `hoistClient` for changing the monad in which *client functions* live. Read [tutorial section for more information](https://docs.servant.dev/en/release-0.14/tutorial/Client.html#changing-the-monad-the-client-functions-live-in). ([#936](https://github.com/haskell-servant/servant/pull/936))@@ -612,7 +632,7 @@ `enter` isn't exported from `Servant` module anymore. You can change `enter` to `hoistServer` in a straight forward way.- Unwrap natural transformation and add a api type `Proxy`:+ Unwrap natural transformation and add an api type `Proxy`: ```diff -server = enter (NT nt) impl
servant.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: servant-version: 0.17+version: 0.18 synopsis: A family of combinators for defining webservices APIs category: Servant, Web@@ -25,7 +25,8 @@ || ==8.2.2 || ==8.4.4 || ==8.6.5- || ==8.8.2+ || ==8.8.3+ || ==8.10.1 , GHCJS == 8.4 extra-source-files:@@ -55,6 +56,7 @@ Servant.API.RemoteHost Servant.API.ReqBody Servant.API.ResponseHeaders+ Servant.API.Status Servant.API.Stream Servant.API.Sub Servant.API.TypeLevel@@ -79,7 +81,7 @@ -- -- note: mtl lower bound is so low because of GHC-7.8 build-depends:- base >= 4.9 && < 4.14+ base >= 4.9 && < 4.15 , bytestring >= 0.10.8.1 && < 0.11 , mtl >= 2.2.2 && < 2.3 , transformers >= 0.5.2.0 && < 0.6@@ -96,7 +98,7 @@ -- Here can be exceptions if we really need features from the newer versions. build-depends: base-compat >= 0.10.5 && < 0.12- , aeson >= 1.4.1.0 && < 1.5+ , aeson >= 1.4.1.0 && < 1.6 , attoparsec >= 0.13.2.2 && < 0.14 , bifunctors >= 5.5.3 && < 5.6 , case-insensitive >= 1.2.0.11 && < 1.3@@ -105,7 +107,7 @@ , http-types >= 0.12.2 && < 0.13 , mmorph >= 1.1.2 && < 1.2 , network-uri >= 2.6.1.0 && < 2.7- , QuickCheck >= 2.12.6.1 && < 2.14+ , QuickCheck >= 2.12.6.1 && < 2.15 , string-conversions >= 0.4.0.1 && < 0.5 , tagged >= 0.8.6 && < 0.9 , vault >= 0.3.1.2 && < 0.4@@ -157,10 +159,10 @@ , text , transformers - -- Additonal dependencies+ -- Additional dependencies build-depends: hspec >= 2.6.0 && < 2.8- , QuickCheck >= 2.12.6.1 && < 2.14+ , QuickCheck >= 2.12.6.1 && < 2.15 , quickcheck-instances >= 0.3.19 && < 0.4 build-tool-depends:
src/Servant/API/Header.hs view
@@ -23,7 +23,7 @@ -- >>> type MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] Referer type Header = Header' '[Optional, Strict] -data Header' (mods :: [*]) (sym :: Symbol) a+data Header' (mods :: [*]) (sym :: Symbol) (a :: *) deriving Typeable -- $setup
src/Servant/API/ResponseHeaders.hs view
@@ -95,7 +95,7 @@ class BuildHeadersTo hs where buildHeadersTo :: [HTTP.Header] -> HList hs- -- ^ Note: if there are multiple occurences of a header in the argument,+ -- ^ Note: if there are multiple occurrences of a header in the argument, -- the values are interspersed with commas before deserialization (see -- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 RFC2616 Sec 4.2>)
+ src/Servant/API/Status.hs view
@@ -0,0 +1,155 @@+{-# LANGUAGE DataKinds #-}+-- Flexible instances is necessary on GHC 8.4 and earlier+{-# LANGUAGE FlexibleInstances #-}+module Servant.API.Status where++import Network.HTTP.Types.Status+import GHC.TypeLits++-- | Witness that a type-level natural number corresponds to a HTTP status code+class KnownNat n => KnownStatus n where+ statusVal :: proxy n -> Status++instance KnownStatus 100 where+ statusVal _ = status100++instance KnownStatus 101 where+ statusVal _ = status101++instance KnownStatus 200 where+ statusVal _ = status200++instance KnownStatus 201 where+ statusVal _ = status201++instance KnownStatus 202 where+ statusVal _ = status202++instance KnownStatus 203 where+ statusVal _ = status203++instance KnownStatus 204 where+ statusVal _ = status204++instance KnownStatus 205 where+ statusVal _ = status205++instance KnownStatus 206 where+ statusVal _ = status206++instance KnownStatus 300 where+ statusVal _ = status300++instance KnownStatus 301 where+ statusVal _ = status301++instance KnownStatus 302 where+ statusVal _ = status302++instance KnownStatus 303 where+ statusVal _ = status303++instance KnownStatus 304 where+ statusVal _ = status304++instance KnownStatus 305 where+ statusVal _ = status305++instance KnownStatus 307 where+ statusVal _ = status307++instance KnownStatus 308 where+ statusVal _ = status308++instance KnownStatus 400 where+ statusVal _ = status400++instance KnownStatus 401 where+ statusVal _ = status401++instance KnownStatus 402 where+ statusVal _ = status402++instance KnownStatus 403 where+ statusVal _ = status403++instance KnownStatus 404 where+ statusVal _ = status404++instance KnownStatus 405 where+ statusVal _ = status405++instance KnownStatus 406 where+ statusVal _ = status406++instance KnownStatus 407 where+ statusVal _ = status407++instance KnownStatus 408 where+ statusVal _ = status408++instance KnownStatus 409 where+ statusVal _ = status409++instance KnownStatus 410 where+ statusVal _ = status410++instance KnownStatus 411 where+ statusVal _ = status411++instance KnownStatus 412 where+ statusVal _ = status412++instance KnownStatus 413 where+ statusVal _ = status413++instance KnownStatus 414 where+ statusVal _ = status414++instance KnownStatus 415 where+ statusVal _ = status415++instance KnownStatus 416 where+ statusVal _ = status416++instance KnownStatus 417 where+ statusVal _ = status417++instance KnownStatus 418 where+ statusVal _ = status418++instance KnownStatus 422 where+ statusVal _ = status422++instance KnownStatus 426 where+ statusVal _ = status426++instance KnownStatus 428 where+ statusVal _ = status428++instance KnownStatus 429 where+ statusVal _ = status429++instance KnownStatus 431 where+ statusVal _ = status431++instance KnownStatus 500 where+ statusVal _ = status500++instance KnownStatus 501 where+ statusVal _ = status501++instance KnownStatus 502 where+ statusVal _ = status502++instance KnownStatus 503 where+ statusVal _ = status503++instance KnownStatus 504 where+ statusVal _ = status504++instance KnownStatus 505 where+ statusVal _ = status505++instance KnownStatus 511 where+ statusVal _ = status511
src/Servant/Links.hs view
@@ -54,7 +54,7 @@ -- >>> toUrlPiece $ safeLink api without -- "bye" ----- If you would like create a helper for generating links only within that API,+-- If you would like to create a helper for generating links only within that API, -- you can partially apply safeLink if you specify a correct type signature -- like so: --@@ -65,7 +65,7 @@ -- >>> apiLink = safeLink api -- >>> :} ----- `safeLink'` allows to make specialise the output:+-- `safeLink'` allows you to specialise the output: -- -- >>> safeLink' toUrlPiece api without -- "bye"@@ -563,7 +563,7 @@ type MkLink (AuthProtect tag :> sub) a = MkLink sub a toLink = simpleToLink (Proxy :: Proxy sub) --- | Helper for implemneting 'toLink' for combinators not affecting link+-- | Helper for implementing 'toLink' for combinators not affecting link -- structure. simpleToLink :: forall sub a combinator.