Commit graph

53 commits

Author SHA1 Message Date
Théophile Choutri
9df5195710
Merge pull request #1463 from sorki/srk/foreignTypo
servant-foreign: fix haddock/example typo
2021-10-11 11:32:29 +02:00
Richard Marko
51c8edb74d servant-foreign: fix haddock/example typo 2021-10-11 10:29:06 +02:00
akhesaCaro
6e5dffbb91 unsupporting GHC < 8.6.5, removing unecessary imports 2021-10-02 13:13:24 +02:00
Philip Patsch
e4865644c1 doc(servant-foreign): Document module
I spend some considerable time reverse engineering the module, so I
thought I’d write the documentation I would have liked to see.

The strategy here is that a user not necessarily has insight into how
servant works internally, or even how to write complex servant routes,
they just want to generate a list of endpoints and convert the `Req`
type into e.g. generated code in $language. Thus, they need to know
the semantics of all fields of Req, how they interact and how they
relate to a plain http route.

I made sure every `f` is replaced with `ftype`, so we have one
conventional way of referring to the foreign type argument everywhere.

Some enums are not set at all, they are marked as such.

`_reqBodyContentType` introduces a major restriction of the module, so
that is mentioned in the documentation for now, until the time it will
be fixed.

A few TODO’s describe places where types don’t make sense but would
introduce API-breaking changes, so these should probably be
simplified,
but bundled in one go.
2021-03-25 11:26:53 +01:00
Philip Patsch
07f7954cc6 chore(servant-foreign): remove dead type Frag
It is not used anywhere and also not exported.
2021-03-25 11:26:53 +01:00
Philip Patsch
c3a517cb4f doc(servant-foreign): Inflection docs & module docs 2021-03-25 11:26:53 +01:00
Andrey Prokopenko
da0c83d318
Add URI fragment as a separate combinator (#1324) 2020-11-18 21:57:20 +03:00
Catherine Galkina
0cbed24f23 Added HasClient and HasForeign instances for NoContentVerb 2019-09-29 14:18:13 +03:00
Oleg Grenrus
3001ed7990 Add mods to StreamBody 2018-11-09 21:49:53 +02:00
Oleg Grenrus
80a047d1d4
Merge pull request #1035 from afcady/multipart-foreign
Implement HasForeign instance
2018-11-07 14:34:58 +02:00
Oleg Grenrus
45c1cbdfd5 Refactor Stream stuff
- Introduce SourceT, which is simple variant of "correct `ListT`".
  There are another variants possible (like in `streaming`),
  but I'm not sure there's much real difference.

- Introduce `Codensity`. There's a flag if people don't want to depend
  on `kan-extensions`.

- `StreamGenerator` and `ResultStream` are both `SourceT`.
  `Stream` combinator in `servant-client` uses `Codensity` for CPS.

- Add servant-machines, servant-conduit, servant-pipes
- Add streaming cookbook: just code, no explanations.
- Add a script to run streaming 'benchmarks'
2018-11-05 15:48:47 +02:00
Andrew Cady
c07f86bda7 introduce type ReqBodyContentType replacing use of Bool 2018-09-17 17:22:32 -04:00
Andrew Cady
62def38a9b Add record to Req type
This is needed for servant-js to know whether to call JSON.stringify()
on the request body or just send it raw.
2018-09-16 21:08:07 -04:00
Oleg Grenrus
cfade67c2f Cleanup pre-GHC-8.0 stuff 2018-07-11 01:39:38 +03:00
Oleg Grenrus
f9bcc15d0b Apply stylish-haskell on all modules 2018-06-29 23:36:39 +03:00
Oleg Grenrus
dcc67f3089 Add FromResultStream/ToStreamGenerator [a] instances.
- Add Streaming endpoint to the comprehensive API.
- Rename BuildFromStream to FromResultStram
   - I'm tempted to rename everything in the Servant.API.Stream
     (add some prefixes, `header` is too good name to steal)

The TODO in `servant-docs` is left intentionally.
2018-06-24 21:52:09 +03:00
Oleg Grenrus
c56fda3869 Support GHC-8.4.1 and newer deps 2018-05-26 01:06:36 +03:00
Oleg Grenrus
3e1748c965 Add description modifier helpers and parametrise Capture 2018-02-15 12:28:42 +02:00
Oleg Grenrus
bc3f61d615 Add Servant.API.Modifiers to servant
Changes Header, ReqBody and QueryParam to take a modifier list.

Resolves https://github.com/haskell-servant/servant/issues/856

ResponseHeader story turns to be somewhat ugly, but it can be made
elegant when https://github.com/haskell-servant/servant/issues/841 is
implemnted, then we can omit HList aka Header Heterogenous List
implementation.

- servant-server changes:

  Writing server side intepretations is quite simple using
  `unfoldRequestArgument`, which makes Header and QueryParam look quite
  the same.

  `ReqBody` cannot be easily made optional with current design (what that
  would mean: No Content-Type Header?), so that dimensions isn't used
  there.

- Add HasLink for all the rest ComprehensiveAPI combinators
- Add 'tricky' Header', QueryParam' endpoints to ComprehensiveAPI
- servant-docs: Quick'n'dirty implementation. Don't use modifiers information (yet).
2018-01-25 09:10:11 +02:00
Michael Sloan
e38892a084 Remove usage of default exts, now "stack ghci" loads all together 2018-01-17 21:16:38 -08:00
Dimitri Sabadie
c1371dd84d Temporary fix for Header. (#843)
servant-foreign: make foreign client Header arguments have the representation of 'Maybe' in those languages
2017-11-27 00:23:55 +01:00
Oleg Grenrus
80c6ba5347 Derive Typeable for internal servant-foreign types 2017-11-06 12:29:43 +02:00
Oliver Charles
bfe6f5b0a4 servant-foreign: Explicitly import Data 2017-11-06 12:21:35 +02:00
Ollie Charles
197d776e08 servant-foreign: Move -XDeriveDataTypeable to servant-foreign.cabal 2017-11-06 12:21:31 +02:00
Ollie Charles
335e30be74 servant-foreign: Derive Data for all types 2017-11-06 12:21:28 +02:00
Catherine Galkina
ec0431d930 Add instances for new combinators 2017-06-08 18:27:36 +03:00
David Turner
fa3f1869f2 Add EmptyForeignAPI and instance HasForeign ... EmptyAPI 2017-05-16 10:07:30 +00:00
Ryan Scott
ec4573d988 Make servant-foreign build on GHC 8.2 2017-04-01 13:56:08 -04:00
Julian K. Arni
92b1196830 Redundant import fixes 2017-01-16 13:20:39 +02:00
Nickolay Kudasov
b836f13dea Remove Elem from servant-foreign 2017-01-16 13:20:39 +02:00
Dario Bertini
c20c09411d Fix javascript function name generation, mostly fixes #191
and remove js-specific code in servant-foreign (code which would now be dead)
2017-01-16 11:47:55 +02:00
Jonathan Lange
cda31614bf servant-foreign support for CaptureAll 2016-07-11 14:47:05 +01:00
Arian van Putten
05379ed7e3 Replace all occurances of () with NoContent
We use NoContent to signify an empty response nowadays. This commit
replaces all occurences of () with NoContent so that all packages use
the new semantics.
2016-07-10 16:58:59 +02:00
Sönke Hahn
5effdfdbbb Rename type variables 'layout' and 'sublayout' to 'api' 2016-07-03 22:46:46 +08:00
Sönke Hahn
b26bbfccda travis: enable -Wall -Werror 2016-04-21 13:06:10 +08:00
Steve Purcell
5188e842a9 [servant-foreign] Parameterise type classes with a foreign representation type
We allow a user-specified type to represent the foreign type of haskell
types encountered in the API. This lets users map Integer, Date etc. to
representations other than Text, and have those representations
available in the returned list of Req.

For example, we might want to map a type which has an instance of
Generic to both a foreign type name and a class declaration for that
foreign type such that it can encode/decode itself to JSON. The previous
limitation to a single Text output prevented this case.
2016-03-14 10:34:53 +13:00
Steve Purcell
207f05e759 [servant-foreign] Parameterise Req with a foreign type 2016-03-13 18:35:49 +13:00
Steve Purcell
bfe812f5d9 [servant-foreign] Normalise names of arg field accessors 2016-03-13 17:27:31 +13:00
Denis Redozubov
d8e98a1f16 fix lens export mismatch 2016-03-12 13:59:40 +03:00
Denis Redozubov
36ddf7663a fix 7.8.4 compilation 2016-03-12 12:51:22 +03:00
Denis Redozubov
e5635a044e use newtypes in servant-foreign 2016-03-12 12:51:22 +03:00
Sönke Hahn
8ef4d4543b renaming: Config -> Context 2016-03-07 23:12:24 +08:00
Denis Redozubov
e6e13fde84 Make servant-foreign code nicer
* non-messy imports
* got rid of most long lines (>80 chars)
* prisms for sum types and newtypes(we use lens anyway, so why not)
* consistent indentation
2016-02-11 15:26:01 +03:00
Sönke Hahn
2176fecfda config: added instances for all interpretations 2016-01-21 17:55:02 +01:00
Julian K. Arni
bd77b4acba Verb for -mock, -js and -foreign. 2016-01-07 13:47:08 +01:00
Maksymilian Owsianny
721151a32d Added default NoTypes parameter for dynamic languages. 2015-12-02 15:56:56 +00:00
Maksymilian Owsianny
0f42e0a7f0 Add documentation of 'HasForeignType'. 2015-12-02 14:10:30 +00:00
Maksymilian Owsianny
e56fc650c2 Added test spec for servant-foreign. 2015-12-02 12:28:04 +00:00
Maksymilian Owsianny
2d8db45907 Moved GenerateList to servant-foreign. 2015-12-02 11:21:37 +00:00
Maksymilian Owsianny
69f09f2622 Added lang parameter. 2015-11-29 04:53:50 +00:00