Commit Graph

415 Commits

Author SHA1 Message Date
Alp Mestanogullari
c2af6e775d better MimeRender/Unrender instances 2021-12-06 17:31:15 +01:00
Gaël Deest
3ed24fdd90
Merge pull request #1289 from acondolu/master
Better errors for partially applied combinators
2021-11-18 10:51:30 +01:00
Gaël Deest
f2bd982eaf Rename proof to g{Client,Server,Link}Proof 2021-11-18 10:25:36 +01:00
Gaël Deest
575aa70eca Cleanup 2021-11-18 10:11:45 +01:00
Gaël Deest
fca59556dd Code reorganization
Move `HasServer (NamedRoutes routes)` instance

The instance has been moved to `Servant.Server.Internal`, as the
instances for other combinators. It is necessary so that the instance
can be re-exported from `Servant.Server` without circular imports.

Otherwise, users have to import `Servant.Server.Generic` manually ;
forgetting to do so will produce confusing error messages about the
missing instance.

Move `HasClient (NamedRoutes routes)` instance

Moved so that the instance is made available when importing
`Servant.Client`, avoiding possibly confusing errors when
`Servant.Client.Generic` isn't imported.
2021-11-18 10:09:58 +01:00
Gaël Deest
b033871dfc Implement HasLink instance for NamedRoutes 2021-11-18 10:09:58 +01:00
Gaël Deest
65e3070cac Add NamedRoutes combinator
Allows users to directly embed APIs defined as records of routes into
vanilla Servant API types.

E.g.:

```haskell
data MyRoutes mode = MyRoutes
  { version :: mode :- Get '[JSON] Int
  , …
  }

type API = "prefix" :> NamedRoutes MyRoutes :<|> …
```

APIs can thus be recursively defined directly with Generic record types.
2021-11-18 10:09:58 +01:00
Gaël Deest
67a37dc3f6 Fix build error on GHC 8.6 2021-11-17 15:29:22 +01:00
Andrea Condoluci
42b7d0eb9b Type-level errors for HasLink for invalid combinators 2021-11-15 21:40:36 +01:00
Théophile Choutri
4e4ad495ef Change the license value to a valid SPDX identifier 2021-10-31 22:37:56 +01:00
Joseph C. Sible
fea40bd0fc Enable FlexibleContexts in Servant.API.ContentTypes
Starting with GHC 9.2, UndecidableInstances no longer implies FlexibleContexts.
Add this extension where it's needed to make compilation succeed.
2021-10-30 23:26:21 -04:00
Gaël Deest
b7c6a95929 Fix tested-with fields in Cabal files
Also re-added `servant-client` to `cabal.ghcjs.project`, setting
`buildable: False` on tests as they don't run with GHCJS.
2021-10-11 10:35:40 +02:00
akhesacaro
e56f0092d7 remove tested-with (GHC < 8.6.5) from cabal 2021-10-02 13:13:33 +02:00
akhesaCaro
6e5dffbb91 unsupporting GHC < 8.6.5, removing unecessary imports 2021-10-02 13:13:24 +02:00
Maxim Koltsov
e2b897d3c0
Prepare 0.18.3 release (#1430) 2021-06-24 00:38:46 +03:00
Maxim Koltsov
61111178f0
Support GHC-9.0.1 2021-06-23 23:06:07 +02:00
Felix Yan
cc67b9ec6e
Allow attoparsec 0.14 (#1408)
Builds fine and all tests pass.
2021-06-21 22:54:50 -05:00
Alp
0c961f6ebb
Fix #1405 (#1429)
Request bodies are not really supposed to be used in GET requests.
2021-06-21 22:54:29 -05:00
Paolo Capriotti
0f9cc7eeec
Add response header support to UVerb (#1420)
* Use type wrapped in Headers h to generate response

This avoids having to define MimeRender instances for Headers.
2021-06-10 17:10:50 +02:00
Samuel Gélineau
0cb2d603c4
use Capture Description if available (#1423)
* use Capture Description if available

* update golden/comprehensive.md

This is technically a breaking change, because if a Capture has both a
Description and a ToCapture instance, the Description now takes
precedence. Since this Description wasn't doing anything before, I am
guessing that most projects currently only use Description to describe
their endpoints and not their Captures, and thus that few people will be
affected by this breaking change.

* test the "no ToCapture instance" case

The case in which there is both a Description and a ToCapture instance
seems like a corner case. The more interesting cases are the one in
which there is a Description but no ToCapture instance, and the case in
which there is a ToCapture instance but no description.
2021-06-08 13:28:19 -05:00
Maxim Koltsov
507f0a4671
Allow hspec < 2.9
https://github.com/commercialhaskell/stackage/issues/6010
2021-05-14 12:34:04 +03:00
Gaël Deest
4a79cea3ff
Merge pull request #1415 from felixonmars/patch-1
Allow singleton-bool 0.1.6
2021-04-29 15:29:02 +02:00
fisx
448c444db6
Typo (#1416) 2021-04-23 10:37:48 +02:00
Felix Yan
3c520683ce
Allow singleton-bool 0.1.6
Builds fine and all tests pass.
2021-04-21 06:16:17 +08:00
Bodigrim
27173c9223
Allow bytestring-0.11 (#1386) 2020-12-16 11:04:49 +01:00
fisx
6ebb9e419e
Fix overlapping MimeRender instances (#1376) 2020-12-09 23:08:54 +01:00
Intolerable
a8f584f80b
add HasLink instance for UVerb (#1370) 2020-12-06 14:19:35 +01:00
Domen Kožar
0bda65e315
links: import toUrlPiece to make it clear where it comes from 2020-12-05 17:00:03 +01:00
Maxim Koltsov
0ad2bd221a
Prepare 0.18.2 release (#1364) 2020-11-22 17:51:32 +03:00
Andrey Prokopenko
da0c83d318
Add URI fragment as a separate combinator (#1324) 2020-11-18 21:57:20 +03:00
Arian van Putten
339eec6a90
Fix overlapping instance for WithStatus (#1361)
We do not need the `ToJSON` instance for `WithStatus`
it would cause an overlap between:

```
ToJSON a => MimeRender JSON a
```

and

```
forall cty a.  MimeRendercty  a =>  MimeRender cty (WithStatus a)
```
and Servant just needs the `MimeRender` typeclass for it to work

* Add some more docs to the UVerb module

* cookbook/uverb: Change GHC versions

CI was complaining some version did not exist. Trying to bump
Also added 8.10.1

* doc/cookbook/uverb: Remove 8.4.4 from tested versions

CI was running into a cabal bug for some reason
2020-11-18 17:33:03 +01:00
Maxim Koltsov
bd698cad3b
Bump version in preparation for new release 2020-11-04 17:06:51 +03:00
fisx
c1105899f4
union verbs (#1314) 2020-10-31 20:45:46 +01:00
fisx
64f3543034
bump "tested-with" ghc versions. (#1350) 2020-10-25 14:24:06 +01:00
Felix Yan
b4b649c8f4
Allow http-api-data 0.4.2
Builds fine and all tests pass here.
2020-08-30 15:26:48 +08:00
Matthias Fischmann
6dcb29bada
Update changelogs. 2020-07-31 20:19:07 +02:00
Maxim Koltsov
43cf589e0e
Bump version to 0.18 2020-07-30 19:03:58 +03:00
Maxim Koltsov
cb0224d063
Add 8.10.1 to tested-with, haskell-ci regenerate 2020-07-17 17:17:45 +03:00
Maxim Koltsov
1a09b1d3a4
Update GHC 8.8.x versions to 8.8.3 2020-07-17 17:10:31 +03:00
Maxim Koltsov
57f0b0b390
Make error messages from combinators configurable
Currently there is no way for Servant users to customize formatting of
error messages that arise when combinators can't parse URL or request
body, apart from reimplementing those combinators for themselves or
using middlewares.

This commit adds a possibility to specify custom error formatters
through Context.

Fixes #685
2020-07-17 17:10:31 +03:00
Leif Warner
0530671ad6
Allow newer versions of base, template-haskell, lens, & unliftio-core 2020-07-03 06:57:52 +02:00
Nathan van Doorn
ff9da1cde4 Use GHC.TypeLits rather than TypeNats 2020-06-13 15:50:12 +01:00
Nathan van Doorn
6889d053c7 Add FlexibleInstances for earlier GHCs 2020-06-13 15:38:36 +01:00
Nathan van Doorn
a8184a2ee0 Add KnownStatus typeclass 2020-06-13 15:10:07 +01:00
Felix Yan
c778a18372
Allow aeson 1.5 (#1302)
Builds fine and all tests pass here.
2020-06-12 02:38:09 -04:00
Jan Hrcek
b9d8fbcdc1
Fix typos and grammar (#1304)
* Fix typos and grammar

* Remove redundant words, fix articles

* More language fixes

* More typo fixes and resolve TODO about missing links
2020-06-06 00:43:51 -04:00
Felix Yan
8f60a02c25
Allow QuickCheck 2.14
Builds fine and all tests pass.
2020-04-02 06:58:22 +08:00
Oleg Grenrus
8fc47edf99 Remove deprecated modules (end of 2019 is passed) 2020-01-23 13:14:24 +02:00
Oleg Grenrus
3bf4b100a8 Bump version to 0.17 2020-01-23 12:50:07 +02:00
Oleg Grenrus
d29b0cc8f1 Use GHC-8.8.2 on Travis 2020-01-21 16:52:20 +02:00