Commit graph

57 commits

Author SHA1 Message Date
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
Maksymilian Owsianny
8932cb242c Add access to types in servant-foreign. 2015-11-28 08:13:26 +00:00
Matthias Fischmann
9b08a05502 Adjust file contents a little. 2015-11-16 18:40:15 +01:00
Matthias Fischmann
a1dcc275eb Just rename the file. 2015-11-16 18:33:35 +01:00
Matt Bray
f6ee02eb91 servant-foreign: fix camelCase
Previous behaviour was a bit shouty (and dashes aren't allowed in JS
variable names):

camelCase ["one", "two", "thirty-three"] => "oneTWOTHIRTY-THREE"

New behaviour:

camelCase ["one", "two", "thirty-three"] => "oneTwoThirtythree"
2015-11-04 11:27:07 +00:00
Julian K. Arni
2a894d861c -Wall fixes 2015-10-13 21:38:13 +02:00
Julian K. Arni
ec55f4b981 Remove Matrix params.
For servant-docs, -foreign, -js, and -mock.
2015-10-13 21:37:07 +02:00
Arian van Putten
4b81f0c77a More test fixes 2015-10-02 15:03:26 +02:00
Arian van Putten
e17987e5ff Convert servant-foreign to use text 2015-10-02 10:23:57 +02:00