on 21bac09 help sign in
8 files changed+68−28
since splitsnapshots
unifiedsplit
.travis.yml+18−7 cabal.make-travis-yml+1−1 doc/index.rst+11−9 doc/introduction.rst → doc/principles.rst+2−2 doc/tutorial/Javascript.lhs+1−2 doc/tutorial/index.rst+21−2 servant-client/servant-client.cabal+2−2 servant/CHANGELOG.md+12−3
.travis.yml+18−7
@@ -13,7 +13,7 @@ git:
1313branches:
1414 only:
1515 - master
16− - release-0.12
16+ - release-0.14
1717
1818cache:
1919 directories:
@@ -65,7 +65,8 @@ install:
6565 - BENCH=${BENCH---enable-benchmarks}
6666 - TEST=${TEST---enable-tests}
6767 - HADDOCK=${HADDOCK-true}
68− - INSTALLED=${INSTALLED-true}
68+ - UNCONSTRAINED=${UNCONSTRAINED-true}
69+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
6970 - GHCHEAD=${GHCHEAD-false}
7071 - travis_retry cabal update -v
7172 - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
@@ -74,8 +75,11 @@ install:
7475 - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
7576 - "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\" \"doc/cookbook/basic-auth\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/https\" \"doc/cookbook/pagination\" \"doc/cookbook/structuring-apis\" \"doc/cookbook/using-custom-monad\"\\n' > cabal.project"
7677 - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
77− - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server, http-media:base' >> cabal.project"
78− - cat cabal.project
78+ - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server, http-media:base, servant-js:servant,servant-pagination:servant,servant-pagination:servant-server' >> cabal.project"
79+ - touch cabal.project.local
80+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
81+ - cat cabal.project || true
82+ - cat cabal.project.local || true
7983 - if [ -f "servant/configure.ac" ]; then
8084 (cd "servant" && autoreconf -i);
8185 fi
@@ -148,11 +152,13 @@ script:
148152 - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
149153 - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal cookbook-basic-auth-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-https-*/*.cabal cookbook-pagination-*/*.cabal cookbook-structuring-apis-*/*.cabal cookbook-using-custom-monad-*/*.cabal\\n' > cabal.project"
150154 - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
151− - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server, http-media:base' >> cabal.project"
152− - cat cabal.project
155+ - "echo 'allow-newer: servant-auth-server:http-types,servant-auth-server:servant-server, http-media:base, servant-js:servant,servant-pagination:servant,servant-pagination:servant-server' >> cabal.project"
156+ - touch cabal.project.local
157+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
158+ - cat cabal.project || true
159+ - cat cabal.project.local || true
153160 - echo -en 'travis_fold:end:unpack\\r'
154161
155−
156162 - echo Building with tests and benchmarks... && echo -en 'travis_fold:start:build-everything\\r'
157163 # build & run tests, build benchmarks
158164 - cabal new-build -w ${HC} ${TEST} ${BENCH} all
@@ -165,5 +171,10 @@ script:
165171 - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
166172
167173 - echo -en 'travis_fold:end:haddock\\r'
174+ - echo Building without installed constraints for packages in global-db... && echo -en 'travis_fold:start:build-installed\\r'
175+ # Build without installed constraints for packages in global-db
176+ - if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi
177+
178+ - echo -en 'travis_fold:end:build-installed\\r'
168179# REGENDATA ["--config=cabal.make-travis-yml","--output=.travis.yml","cabal.project"]
169180# EOF
cabal.make-travis-yml+1−1
@@ -1,5 +1,5 @@
11folds: all-but-test
2−branches: master release-0.12
2+branches: master release-0.14
33
44-- We have inplace packages (servant-js) so we skip installing dependencies in a separate step
55install-dependencies-step: False
doc/index.rst+11−9
@@ -3,22 +3,24 @@ servant – A Type-Level Web DSL
33
44.. image:: https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png
55
6−**servant** is a set of packages for declaring web APIs at the type-level and
7−then using those API specifications to:
6+**servant** is a set of Haskell libraries for writing *type-safe* web
7+applications but also *deriving* clients (in Haskell and other languages) or
8+generating documentation for them, and more.
89
9−- write servers (this part of **servant** can be considered a web framework),
10−- obtain client functions (in haskell),
11−- generate client functions for other programming languages,
12−- generate documentation for your web applications
13−- and more...
10+This is achieved by taking as input a description of the web API
11+as a Haskell type. Servant is then able to check that your server-side request
12+handlers indeed implement your web API faithfully, or to automatically derive
13+Haskell functions that can hit a web application that implements this API,
14+generate a Swagger description or code for client functions in some other
15+languages directly.
1416
15−All in a type-safe manner.
17+If you would like to learn more, click the tutorial link below.
1618
1719.. toctree::
1820 :maxdepth: 2
1921
20− introduction.rst
2122 tutorial/index.rst
2223 cookbook/index.rst
2324 examples.md
2425 links.rst
26+ principles.rst
doc/introduction.rst → doc/principles.rstrenamed+2−2
@@ -1,5 +1,5 @@
1−Introduction
2−------------
1+Principles
2+----------
33
44**servant** has the following guiding principles:
55
doc/tutorial/Javascript.lhs+1−2
@@ -477,7 +477,7 @@ data AngularOptions = AngularOptions
477477 }
478478```
479479
480−# Custom function name builder
480+## Custom function name builder
481481
482482Servant comes with three name builders included:
483483
@@ -518,4 +518,3 @@ var get_books = function(q, onSuccess, onError)
518518}
519519
520520```
521−
doc/tutorial/index.rst+21−2
@@ -3,9 +3,28 @@ Tutorial
33
44This is an introductory tutorial to **servant**. Whilst browsing is fine, it makes more sense if you read the sections in order, or at least read the first section before anything else.
55
6−(Any comments, issues or feedback about the tutorial can be submitted
7−to `servant's issue tracker <http://github.com/haskell-servant/servant/issues>`_.)
6+Any comments, issues or feedback about the tutorial can be submitted
7+to `servant's issue tracker <http://github.com/haskell-servant/servant/issues>`_.
88
9+In fact, the whole tutorial is a `cabal <https://cabal.readthedocs.io/en/latest/>`_
10+project and can be built and played with locally as follows:
11+
12+.. code-block:: bash
13+
14+ $ git clone https://github.com/haskell-servant/servant.git
15+ $ cd servant
16+ # build
17+ $ cabal new-build tutorial
18+ # load in ghci to play with it
19+ $ cabal new-repl tutorial
20+
21+The code can be found in the `*.lhs` files under `doc/tutorial/` in the
22+repository. Feel free to edit it while you're reading this documentation and
23+see the effect of your changes.
24+
25+`Nix <https://nixos.org/nix/>`_ users should feel free to take a look at
26+the `nix/shell.nix` file in the repository and use it to provision a suitable
27+environment to build and run the examples.
928
1029.. toctree::
1130 :maxdepth: 1
servant-client/servant-client.cabal+2−2
@@ -124,8 +124,8 @@ test-suite spec
124124 , random-bytestring >= 0.1 && < 0.2
125125 , network >= 2.6.3.2 && < 2.8
126126 , QuickCheck >= 2.10.1 && < 2.12
127− , servant == 0.13.*
128− , servant-server == 0.13.*
127+ , servant == 0.14.*
128+ , servant-server == 0.14.*
129129
130130 build-tool-depends:
131131 hspec-discover:hspec-discover >= 2.4.4 && < 2.6
servant/CHANGELOG.md+12−3
@@ -37,9 +37,18 @@
3737- *servant-client* Add `hoistClient` to `HasClient`.
3838 Just like `hoistServer` allows us to change the monad in which request handlers
3939 of a web application live in, we also have `hoistClient` for changing the monad
40− in which *client functions* live. Read [tutorial section for more information](#link).
40+ in which *client functions* live.
41+ Read [tutorial section for more information](https://haskell-servant.readthedocs.io/en/release-0.14/tutorial/Client.html#changing-the-monad-the-client-functions-live-in).
4142 ([#936](https://github.com/haskell-servant/servant/pull/936))
4243
44+ iF you have own combinators, you'll need to define a new method of
45+ `HasClient` class, for example:
46+
47+ ```haskell
48+ type Client m (MyCombinator :> api) = MyValue :> Client m api
49+ hoistClientMonad pm _ nt cl = hoistClientMonad pm (Proxy :: Proxy api) nt . cl
50+ ```
51+
4352- *servant* Add `safeLink' :: (Link -> a) -> ... -> MkLink endpoint a`,
4453 which allows to create helpers returning something else than `Link`.
4554 ([#968](https://github.com/haskell-servant/servant/pull/968))
@@ -76,10 +85,10 @@
7685- Added tests or enabled tests
7786 ([#975](https://github.com/haskell-servant/servant/pull/975))
7887
79−- Add [pagination cookbook recipe](#link)
88+- Add [pagination cookbook recipe](https://haskell-servant.readthedocs.io/en/release-0.14/cookbook/pagination/Pagination.html)
8089 ([#946](https://github.com/haskell-servant/servant/pull/946))
8190
82−- Add [`servant-flatten` cookbook recipe](#link)
91+- Add [`servant-flatten` "spice" to the structuring api recipe](https://haskell-servant.readthedocs.io/en/release-0.14/cookbook/structuring-apis/StructuringApis.html)
8392 ([#929](https://github.com/haskell-servant/servant/pull/929))
8493
8594- Dependency updates