on master help sign in
Merge pull request #50 from haskell-servant/jkarni/sundry-cleanup
6651df5Julian Arni
.travis.yml+12−4
@@ -1,11 +1,19 @@
1language: haskell
1language: haskell
2
2
3−ghc:
3+env:
4− - 7.8
4+ - CABALVER=1.18 GHCVER=7.8.4
5+ - CABALVER=1.22 GHCVER=7.10.1
6+
7+before_install:
8+ - travis_retry sudo add-apt-repository -y ppa:hvr/ghc
9+ - travis_retry sudo apt-get update
10+ - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER
11+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
12+ - travis_retry cabal update
5
13
6install:
14install:
7− - ghc --version
15+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
8− - cabal --version
16+ - cabal --version
9
17
10script:
18script:
11 - ./scripts/test-all.sh
19 - ./scripts/test-all.sh
servant/README.md → README.mdrenamed+5−5
@@ -21,8 +21,8 @@ We've written a [Getting Started](http://haskell-servant.github.io/getting-start
21
21
22## Repositories and Haddocks
22## Repositories and Haddocks
23
23
24−- The core [servant](http://github.com/haskell-servant) package - [docs](http://hackage.haskell.org/package/servant)
24+- The core [servant](http://github.com/haskell-servant/tree/master/servant) package - [docs](http://hackage.haskell.org/package/servant)
25−- Implementing an HTTP server for a webservice API with [servant-server](http://github.com/haskell-servant/servant-server) - [docs](http://hackage.haskell.org/package/servant-server)
25+- Implementing an HTTP server for a webservice API with [servant-server](http://github.com/haskell-servant/servant/tree/master/servant-server) - [docs](http://hackage.haskell.org/package/servant-server)
26−- (Haskell) client-side function generation with [servant-client](http://github.com/haskell-servant/servant-client) - [docs](http://hackage.haskell.org/package/servant-client)
26+- (Haskell) client-side function generation with [servant-client](http://github.com/haskell-servant/servant/tree/master/servant-client) - [docs](http://hackage.haskell.org/package/servant-client)
27−- (Javascript) client-side function generation with [servant-jquery](http://github.com/haskell-servant/servant-jquery) - [docs](http://hackage.haskell.org/package/servant-jquery)
27+- (Javascript) client-side function generation with [servant-jquery](http://github.com/haskell-servant/servant/tree/master/servant-jquery) - [docs](http://hackage.haskell.org/package/servant-jquery)
28−- API docs generation with [servant-docs](http://github.com/haskell-servant/servant-docs) - [docs](http://hackage.haskell.org/package/servant-docs)
28+- API docs generation with [servant-docs](http://github.com/haskell-servant/servant/tree/master/servant-docs) - [docs](http://hackage.haskell.org/package/servant-docs)
scripts/shell.nixnew file+20
@@ -0,0 +1,20 @@
1+# Get a Nix shell with all the packages installed
2+# Also a good way of running the tests for all packages
3+with (import <nixpkgs> {}).pkgs;
4+let modifiedHaskellPackages = haskellngPackages.override {
5+ overrides = with haskell-ng.lib ; self: super: {
6+ servant = appendConfigureFlag ( self.callPackage ../servant {} )
7+ "--ghc-options=-Werror";
8+ servant-server = appendConfigureFlag (self.callPackage
9+ ../servant-server {}) "--ghc-options=-Werror";
10+ servant-client = appendConfigureFlag (self.callPackage
11+ ../servant-client {}) "--ghc-options=-Werror";
12+ servant-jquery = appendConfigureFlag (self.callPackage
13+ ../servant-jquery {}) "--ghc-options=-Werror";
14+ servant-docs = appendConfigureFlag (self.callPackage ../servant-docs
15+ {}) "--ghc-options=-Werror";
16+ };
17+ };
18+in modifiedHaskellPackages.ghcWithPackages ( p : with p ; [
19+ servant servant-server servant-client servant-jquery servant-docs
20+])
scripts/test-all.sh+14−10
@@ -8,21 +8,25 @@
8# DESCRIPTION: Run tests for all source directories listed in $SOURCES.
8# DESCRIPTION: Run tests for all source directories listed in $SOURCES.
9# Uses local versions of those sources.
9# Uses local versions of those sources.
10#
10#
11+# REQUIREMENTS: bash >= 4
11#===============================================================================
12#===============================================================================
12
13
13set -o nounset
14set -o nounset
14set -o errexit
15set -o errexit
15
16
16−SOURCES=( servant servant-server servant-client servant-jquery servant-docs )
17+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
17GHC_FLAGS="-Werror"
18GHC_FLAGS="-Werror"
19+SOURCES_TXT="$( dirname $DIR)/sources.txt"
20+CABAL=${CABAL:-cabal}
21+
22+declare -a SOURCES
23+readarray -t SOURCES < "$SOURCES_TXT"
24+
18
25
19prepare_sandbox () {
26prepare_sandbox () {
20− cabal sandbox init
27+ $CABAL sandbox init
21 for s in ${SOURCES[@]} ; do
28 for s in ${SOURCES[@]} ; do
22− cd "$s"
23− cabal sandbox init --sandbox=../
29+ (cd "$s" && $CABAL sandbox init --sandbox=../ && $CABAL sandbox add-source .)
24− cabal sandbox add-source .
25− cd ..
26 done
30 done
27}
31}
28
32
@@ -30,10 +34,10 @@ test_each () {
30 for s in ${SOURCES[@]} ; do
34 for s in ${SOURCES[@]} ; do
31 echo "Testing $s..."
35 echo "Testing $s..."
32 cd "$s"
36 cd "$s"
33− cabal install --only-dependencies --enable-tests
37+ $CABAL install --only-dependencies --enable-tests
34− cabal configure --enable-tests --ghc-options="$GHC_FLAGS"
38+ $CABAL configure --enable-tests --ghc-options="$GHC_FLAGS"
35− cabal build
39+ $CABAL build
36− cabal test
40+ $CABAL test
37 cd ..
41 cd ..
38 done
42 done
39}
43}
scripts/update-defaults-nix.shnew file+24
@@ -0,0 +1,24 @@
1+#!/bin/bash -
2+#===============================================================================
3+#
4+# USAGE: ./update-defaults-nix.sh
5+#
6+# DESCRIPTION: Updates the default.nix files in all source dirs
7+#
8+# REQUIREMENTS: cabal2nix, bash >= 4
9+#===============================================================================
10+
11+set -o nounset
12+set -o errexit
13+
14+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
15+BASE_DIR="$( dirname $DIR)"
16+SOURCES_TXT="$BASE_DIR/sources.txt"
17+
18+declare -a SOURCES
19+readarray -t SOURCES < "$SOURCES_TXT"
20+
21+for s in ${SOURCES[@]} ; do
22+ echo $s
23+ (cd "$BASE_DIR/$s" && cabal2nix . > default.nix )
24+done
servant-client/README.md+1−4
@@ -1,8 +1,5 @@
1# servant-client
1# servant-client
2
2
3−[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-client.svg)](http://travis-ci.org/haskell-servant/servant-client)
4−[![Coverage Status](https://coveralls.io/repos/haskell-servant/servant-client/badge.svg)](https://coveralls.io/r/haskell-servant/servant-client)
5−
6![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
3![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
7
4
8This library lets you automatically derive Haskell functions that let you query each endpoint of a *servant* webservice.
5This library lets you automatically derive Haskell functions that let you query each endpoint of a *servant* webservice.
@@ -20,4 +17,4 @@ getAllBooks :: BaseUrl -> EitherT String IO [Book]
20postNewBook :: Book -> BaseUrl -> EitherT String IO Book
17postNewBook :: Book -> BaseUrl -> EitherT String IO Book
21-- 'client' allows you to produce operations to query an API from a client.
18-- 'client' allows you to produce operations to query an API from a client.
22(getAllBooks :<|> postNewBook) = client myApi
19(getAllBooks :<|> postNewBook) = client myApi
23−```
20+```
servant-client/default.nixnew file+24
@@ -0,0 +1,24 @@
1+{ mkDerivation, aeson, attoparsec, base, bytestring, deepseq
2+, either, exceptions, hspec, http-client, http-client-tls
3+, http-media, http-types, HUnit, network, network-uri, QuickCheck
4+, safe, servant, servant-server, stdenv, string-conversions, text
5+, transformers, wai, warp
6+}:
7+mkDerivation {
8+ pname = "servant-client";
9+ version = "0.2.2";
10+ src = ./.;
11+ buildDepends = [
12+ aeson attoparsec base bytestring either exceptions http-client
13+ http-client-tls http-media http-types network-uri safe servant
14+ string-conversions text transformers
15+ ];
16+ testDepends = [
17+ aeson base bytestring deepseq either hspec http-client http-media
18+ http-types HUnit network QuickCheck servant servant-server text wai
19+ warp
20+ ];
21+ homepage = "http://haskell-servant.github.io/";
22+ description = "automatical derivation of querying functions for servant webservices";
23+ license = stdenv.lib.licenses.bsd3;
24+}
servant-client/servant-client.cabal+4−2
@@ -16,6 +16,8 @@ description:
16 > getAllBooks :: BaseUrl -> EitherT String IO [Book]
16 > getAllBooks :: BaseUrl -> EitherT String IO [Book]
17 > postNewBook :: Book -> BaseUrl -> EitherT String IO Book
17 > postNewBook :: Book -> BaseUrl -> EitherT String IO Book
18 > (getAllBooks :<|> postNewBook) = client myApi
18 > (getAllBooks :<|> postNewBook) = client myApi
19+ .
20+ <https://github.com/haskell-servant/servant/blob/master/servant-client/CHANGELOG.md CHANGELOG>
19license: BSD3
21license: BSD3
20license-file: LICENSE
22license-file: LICENSE
21author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
23author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
@@ -26,10 +28,10 @@ build-type: Simple
26cabal-version: >=1.10
28cabal-version: >=1.10
27tested-with: GHC >= 7.8
29tested-with: GHC >= 7.8
28homepage: http://haskell-servant.github.io/
30homepage: http://haskell-servant.github.io/
29−Bug-reports: http://github.com/haskell-servant/servant-client/issues
31+Bug-reports: http://github.com/haskell-servant/servant/issues
30source-repository head
32source-repository head
31 type: git
33 type: git
32− location: http://github.com/haskell-servant/servant-client.git
34+ location: http://github.com/haskell-servant/servant.git
33
35
34library
36library
35 exposed-modules:
37 exposed-modules:
servant-client/src/Servant/Client.hs+66−31
@@ -1,12 +1,15 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE CPP #-}
2−{-# LANGUAGE InstanceSigs #-}
2+{-# LANGUAGE DataKinds #-}
3−{-# LANGUAGE TypeFamilies #-}
4−{-# LANGUAGE TypeOperators #-}
5−{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE FlexibleContexts #-}
6−{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE InstanceSigs #-}
7−{-# LANGUAGE OverloadedStrings #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE ScopedTypeVariables #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
10+#if !MIN_VERSION_base(4,8,0)
8{-# LANGUAGE OverlappingInstances #-}
11{-# LANGUAGE OverlappingInstances #-}
9−{-# LANGUAGE ScopedTypeVariables #-}
12+#endif
10-- | This module provides 'client' which can automatically generate
13-- | This module provides 'client' which can automatically generate
11-- querying functions for each endpoint just from the type representing your
14-- querying functions for each endpoint just from the type representing your
12-- API.
15-- API.
@@ -18,21 +21,21 @@ module Servant.Client
18 , module Servant.Common.BaseUrl
21 , module Servant.Common.BaseUrl
19 ) where
22 ) where
20
23
21−import Control.Monad
24+import Control.Monad
22−import Control.Monad.Trans.Either
25+import Control.Monad.Trans.Either
23−import Data.ByteString.Lazy (ByteString)
26+import Data.ByteString.Lazy (ByteString)
24−import Data.List
27+import Data.List
25−import Data.Proxy
28+import Data.Proxy
26−import Data.String.Conversions
29+import Data.String.Conversions
27−import Data.Text (unpack)
30+import Data.Text (unpack)
28−import GHC.TypeLits
31+import GHC.TypeLits
29−import Network.HTTP.Client (Response)
32+import Network.HTTP.Client (Response)
30−import Network.HTTP.Media
33+import Network.HTTP.Media
31−import qualified Network.HTTP.Types as H
34+import qualified Network.HTTP.Types as H
32−import Servant.API
35+import Servant.API
33−import Servant.API.ContentTypes
36+import Servant.API.ContentTypes
34−import Servant.Common.BaseUrl
37+import Servant.Common.BaseUrl
35−import Servant.Common.Req
38+import Servant.Common.Req
36
39
37-- * Accessing APIs as a Client
40-- * Accessing APIs as a Client
38
41
@@ -123,14 +126,22 @@ instance HasClient Delete where
123-- side querying function that is created when calling 'client'
126-- side querying function that is created when calling 'client'
124-- will just require an argument that specifies the scheme, host
127-- will just require an argument that specifies the scheme, host
125-- and port to send the request to.
128-- and port to send the request to.
129+instance
130+#if MIN_VERSION_base(4,8,0)
131+ {-# OVERLAPPABLE #-}
132+#endif
126−instance (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where
133+ (MimeUnrender ct result) => HasClient (Get (ct ': cts) result) where
127 type Client' (Get (ct ': cts) result) = BaseUrl -> EitherT ServantError IO result
134 type Client' (Get (ct ': cts) result) = BaseUrl -> EitherT ServantError IO result
128 clientWithRoute Proxy req host =
135 clientWithRoute Proxy req host =
129 performRequestCT (Proxy :: Proxy ct) H.methodGet req [200, 203] host
136 performRequestCT (Proxy :: Proxy ct) H.methodGet req [200, 203] host
130
137
131-- | If you have a 'Get xs ()' endpoint, the client expects a 204 No Content
138-- | If you have a 'Get xs ()' endpoint, the client expects a 204 No Content
132-- HTTP header.
139-- HTTP header.
140+instance
141+#if MIN_VERSION_base(4,8,0)
142+ {-# OVERLAPPING #-}
143+#endif
133−instance HasClient (Get (ct ': cts) ()) where
144+ HasClient (Get (ct ': cts) ()) where
134 type Client' (Get (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
145 type Client' (Get (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
135 clientWithRoute Proxy req host =
146 clientWithRoute Proxy req host =
136 performRequestNoBody H.methodGet req [204] host
147 performRequestNoBody H.methodGet req [204] host
@@ -176,7 +187,11 @@ instance (KnownSymbol sym, ToText a, HasClient sublayout)
176-- side querying function that is created when calling 'client'
187-- side querying function that is created when calling 'client'
177-- will just require an argument that specifies the scheme, host
188-- will just require an argument that specifies the scheme, host
178-- and port to send the request to.
189-- and port to send the request to.
190+instance
191+#if MIN_VERSION_base(4,8,0)
192+ {-# OVERLAPPABLE #-}
193+#endif
179−instance (MimeUnrender ct a) => HasClient (Post (ct ': cts) a) where
194+ (MimeUnrender ct a) => HasClient (Post (ct ': cts) a) where
180 type Client' (Post (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
195 type Client' (Post (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
181
196
182 clientWithRoute Proxy req uri =
197 clientWithRoute Proxy req uri =
@@ -184,7 +199,11 @@ instance (MimeUnrender ct a) => HasClient (Post (ct ': cts) a) where
184
199
185-- | If you have a 'Post xs ()' endpoint, the client expects a 204 No Content
200-- | If you have a 'Post xs ()' endpoint, the client expects a 204 No Content
186-- HTTP header.
201-- HTTP header.
202+instance
203+#if MIN_VERSION_base(4,8,0)
204+ {-# OVERLAPPING #-}
205+#endif
187−instance HasClient (Post (ct ': cts) ()) where
206+ HasClient (Post (ct ': cts) ()) where
188 type Client' (Post (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
207 type Client' (Post (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
189 clientWithRoute Proxy req host =
208 clientWithRoute Proxy req host =
190 void $ performRequestNoBody H.methodPost req [204] host
209 void $ performRequestNoBody H.methodPost req [204] host
@@ -193,7 +212,11 @@ instance HasClient (Post (ct ': cts) ()) where
193-- side querying function that is created when calling 'client'
212-- side querying function that is created when calling 'client'
194-- will just require an argument that specifies the scheme, host
213-- will just require an argument that specifies the scheme, host
195-- and port to send the request to.
214-- and port to send the request to.
215+instance
216+#if MIN_VERSION_base(4,8,0)
217+ {-# OVERLAPPABLE #-}
218+#endif
196−instance (MimeUnrender ct a) => HasClient (Put (ct ': cts) a) where
219+ (MimeUnrender ct a) => HasClient (Put (ct ': cts) a) where
197 type Client' (Put (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
220 type Client' (Put (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
198
221
199 clientWithRoute Proxy req host =
222 clientWithRoute Proxy req host =
@@ -201,7 +224,11 @@ instance (MimeUnrender ct a) => HasClient (Put (ct ': cts) a) where
201
224
202-- | If you have a 'Put xs ()' endpoint, the client expects a 204 No Content
225-- | If you have a 'Put xs ()' endpoint, the client expects a 204 No Content
203-- HTTP header.
226-- HTTP header.
227+instance
228+#if MIN_VERSION_base(4,8,0)
229+ {-# OVERLAPPING #-}
230+#endif
204−instance HasClient (Put (ct ': cts) ()) where
231+ HasClient (Put (ct ': cts) ()) where
205 type Client' (Put (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
232 type Client' (Put (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
206 clientWithRoute Proxy req host =
233 clientWithRoute Proxy req host =
207 void $ performRequestNoBody H.methodPut req [204] host
234 void $ performRequestNoBody H.methodPut req [204] host
@@ -210,7 +237,11 @@ instance HasClient (Put (ct ': cts) ()) where
210-- side querying function that is created when calling 'client'
237-- side querying function that is created when calling 'client'
211-- will just require an argument that specifies the scheme, host
238-- will just require an argument that specifies the scheme, host
212-- and port to send the request to.
239-- and port to send the request to.
240+instance
241+#if MIN_VERSION_base(4,8,0)
242+ {-# OVERLAPPABLE #-}
243+#endif
213−instance (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
244+ (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
214 type Client' (Patch (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
245 type Client' (Patch (ct ': cts) a) = BaseUrl -> EitherT ServantError IO a
215
246
216 clientWithRoute Proxy req host =
247 clientWithRoute Proxy req host =
@@ -218,7 +249,11 @@ instance (MimeUnrender ct a) => HasClient (Patch (ct ': cts) a) where
218
249
219-- | If you have a 'Patch xs ()' endpoint, the client expects a 204 No Content
250-- | If you have a 'Patch xs ()' endpoint, the client expects a 204 No Content
220-- HTTP header.
251-- HTTP header.
252+instance
253+#if MIN_VERSION_base(4,8,0)
254+ {-# OVERLAPPING #-}
255+#endif
221−instance HasClient (Patch (ct ': cts) ()) where
256+ HasClient (Patch (ct ': cts) ()) where
222 type Client' (Patch (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
257 type Client' (Patch (ct ': cts) ()) = BaseUrl -> EitherT ServantError IO ()
223 clientWithRoute Proxy req host =
258 clientWithRoute Proxy req host =
224 void $ performRequestNoBody H.methodPatch req [204] host
259 void $ performRequestNoBody H.methodPatch req [204] host
servant-client/src/Servant/Common/Req.hs+4−1
@@ -1,8 +1,11 @@
1+{-# LANGUAGE CPP #-}
1−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
3module Servant.Common.Req where
4module Servant.Common.Req where
4
5
6+#if !MIN_VERSION_base(4,8,0)
5import Control.Applicative
7import Control.Applicative
8+#endif
6import Control.Exception
9import Control.Exception
7import Control.Monad
10import Control.Monad
8import Control.Monad.Catch (MonadThrow)
11import Control.Monad.Catch (MonadThrow)
servant-client/test/Servant/ClientSpec.hs+5−2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleContexts #-}
@@ -10,7 +11,9 @@
10{-# OPTIONS_GHC -fno-warn-orphans #-}
11{-# OPTIONS_GHC -fno-warn-orphans #-}
11module Servant.ClientSpec where
12module Servant.ClientSpec where
12
13
14+#if !MIN_VERSION_base(4,8,0)
13−import Control.Applicative
15+import Control.Applicative ((<$>))
16+#endif
14import qualified Control.Arrow as Arrow
17import qualified Control.Arrow as Arrow
15import Control.Concurrent
18import Control.Concurrent
16import Control.Exception
19import Control.Exception
@@ -340,6 +343,6 @@ pathGen :: Gen (NonEmptyList Char)
340pathGen = fmap NonEmpty path
343pathGen = fmap NonEmpty path
341 where
344 where
342 path = listOf1 $ elements $
345 path = listOf1 $ elements $
343− filter (not . (`elem` "?%[]/#;")) $
346+ filter (not . (`elem` ("?%[]/#;" :: String))) $
344 filter isPrint $
347 filter isPrint $
345 map chr [0..127]
348 map chr [0..127]
servant-client/test/Servant/Common/BaseUrlSpec.hs+3
@@ -1,7 +1,10 @@
1+{-# LANGUAGE CPP #-}
1{-# OPTIONS_GHC -fno-warn-orphans #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
2module Servant.Common.BaseUrlSpec where
3module Servant.Common.BaseUrlSpec where
3
4
5+#if !MIN_VERSION_base(4,8,0)
4import Control.Applicative
6import Control.Applicative
7+#endif
5import Control.DeepSeq
8import Control.DeepSeq
6import Test.Hspec
9import Test.Hspec
7import Test.QuickCheck
10import Test.QuickCheck
servant-docs/README.md+1−3
@@ -1,14 +1,12 @@
1# servant-docs
1# servant-docs
2
2
3−[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-docs.svg)](http://travis-ci.org/haskell-servant/servant-docs)
4−
5![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
3![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
6
4
7Generate API docs for your *servant* webservice. Feel free to also take a look at [servant-pandoc](https://github.com/mpickering/servant-pandoc) which uses this package to target a broad range of output formats using the excellent **pandoc**.
5Generate API docs for your *servant* webservice. Feel free to also take a look at [servant-pandoc](https://github.com/mpickering/servant-pandoc) which uses this package to target a broad range of output formats using the excellent **pandoc**.
8
6
9## Example
7## Example
10
8
11−See [here](https://github.com/haskell-servant/servant-docs/blob/master/example/greet.md) for the output of the following program.
9+See [here](https://github.com/haskell-servant/servant/tree/master/servant-docs/blob/master/example/greet.md) for the output of the following program.
12
10
13``` haskell
11``` haskell
14{-# LANGUAGE DataKinds #-}
12{-# LANGUAGE DataKinds #-}
servant-docs/default.nix+1−1
@@ -12,7 +12,7 @@ mkDerivation {
12 aeson base bytestring hashable http-media lens servant
12 aeson base bytestring hashable http-media lens servant
13 string-conversions text unordered-containers
13 string-conversions text unordered-containers
14 ];
14 ];
15− testDepends = [ aeson base hspec lens servant ];
15+ testDepends = [ aeson base hspec servant string-conversions ];
16 homepage = "http://haskell-servant.github.io/";
16 homepage = "http://haskell-servant.github.io/";
17 description = "generate API docs for your servant webservice";
17 description = "generate API docs for your servant webservice";
18 license = stdenv.lib.licenses.bsd3;
18 license = stdenv.lib.licenses.bsd3;
servant-docs/servant-docs.cabal+4−2
@@ -5,6 +5,8 @@ description:
5 Library for generating API docs from a servant API definition.
5 Library for generating API docs from a servant API definition.
6 .
6 .
7 Runnable example <https://github.com/haskell-servant/servant-docs/blob/master/example/greet.hs here>.
7 Runnable example <https://github.com/haskell-servant/servant-docs/blob/master/example/greet.hs here>.
8+ .
9+ <https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md CHANGELOG>
8license: BSD3
10license: BSD3
9license-file: LICENSE
11license-file: LICENSE
10author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
12author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
@@ -15,13 +17,13 @@ build-type: Simple
15cabal-version: >=1.10
17cabal-version: >=1.10
16tested-with: GHC >= 7.8
18tested-with: GHC >= 7.8
17homepage: http://haskell-servant.github.io/
19homepage: http://haskell-servant.github.io/
18−Bug-reports: http://github.com/haskell-servant/servant-docs/issues
20+Bug-reports: http://github.com/haskell-servant/servant/issues
19extra-source-files:
21extra-source-files:
20 CHANGELOG.md
22 CHANGELOG.md
21 README.md
23 README.md
22source-repository head
24source-repository head
23 type: git
25 type: git
24− location: http://github.com/haskell-servant/servant-docs.git
26+ location: http://github.com/haskell-servant/servant.git
25
27
26library
28library
27 exposed-modules:
29 exposed-modules:
servant-docs/src/Servant/Docs/Internal.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE DeriveGeneric #-}
@@ -13,7 +14,9 @@
13{-# LANGUAGE UndecidableInstances #-}
14{-# LANGUAGE UndecidableInstances #-}
14module Servant.Docs.Internal where
15module Servant.Docs.Internal where
15
16
17+#if !MIN_VERSION_base(4,8,0)
16import Control.Applicative
18import Control.Applicative
19+#endif
17import Control.Lens
20import Control.Lens
18import Data.ByteString.Lazy.Char8 (ByteString)
21import Data.ByteString.Lazy.Char8 (ByteString)
19import Data.Hashable
22import Data.Hashable
servant-jquery/README.md+3−6
@@ -1,15 +1,12 @@
1# servant-jquery
1# servant-jquery
2
2
3−[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-jquery.svg)](http://travis-ci.org/haskell-servant/servant-jquery)
4−[![Coverage Status](https://coveralls.io/repos/haskell-servant/servant-jquery/badge.svg)](https://coveralls.io/r/haskell-servant/servant-jquery)
5−
6![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
3![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
7
4
8This library lets you derive automatically (JQuery based) Javascript functions that let you query each endpoint of a *servant* webservice.
5This library lets you derive automatically (JQuery based) Javascript functions that let you query each endpoint of a *servant* webservice.
9
6
10## Example
7## Example
11
8
12−Read more about the following example [here](https://github.com/haskell-servant/servant-jquery/tree/master/examples#examples).
9+Read more about the following example [here](https://github.com/haskell-servant/servant/tree/master/servant-jquery/tree/master/examples#examples).
13
10
14``` haskell
11``` haskell
15{-# LANGUAGE DataKinds #-}
12{-# LANGUAGE DataKinds #-}
@@ -53,7 +50,7 @@ currentValue counter = liftIO $ readTVarIO counter
53-- * Our API type
50-- * Our API type
54type TestApi = "counter" :> Post Counter -- endpoint for increasing the counter
51type TestApi = "counter" :> Post Counter -- endpoint for increasing the counter
55 :<|> "counter" :> Get Counter -- endpoint to get the current value
52 :<|> "counter" :> Get Counter -- endpoint to get the current value
56− :<|> Raw -- used for serving static files
53+ :<|> Raw -- used for serving static files
57
54
58testApi :: Proxy TestApi
55testApi :: Proxy TestApi
59testApi = Proxy
56testApi = Proxy
@@ -94,4 +91,4 @@ main = do
94
91
95 -- listen to requests on port 8080
92 -- listen to requests on port 8080
96 runServer cnt 8080
93 runServer cnt 8080
97−```
94+```
servant-jquery/default.nixnew file+21
@@ -0,0 +1,21 @@
1+{ mkDerivation, aeson, base, charset, filepath, hspec
2+, hspec-expectations, language-ecmascript, lens, servant
3+, servant-server, stdenv, stm, text, transformers, warp
4+}:
5+mkDerivation {
6+ pname = "servant-jquery";
7+ version = "0.2.2";
8+ src = ./.;
9+ isLibrary = true;
10+ isExecutable = true;
11+ buildDepends = [
12+ aeson base charset filepath lens servant servant-server stm text
13+ transformers warp
14+ ];
15+ testDepends = [
16+ base hspec hspec-expectations language-ecmascript lens servant
17+ ];
18+ homepage = "http://haskell-servant.github.io/";
19+ description = "Automatically derive (jquery) javascript functions to query servant webservices";
20+ license = stdenv.lib.licenses.bsd3;
21+}
servant-jquery/servant-jquery.cabal+7−4
@@ -4,8 +4,11 @@ synopsis: Automatically derive (jquery) javascript functions to query
4description:
4description:
5 Automatically derive jquery-based javascript functions to query servant webservices.
5 Automatically derive jquery-based javascript functions to query servant webservices.
6 .
6 .
7− Example <https://github.com/haskell-servant/servant-jquery/blob/master/examples/counter.hs here> that serves the generated javascript to a webpage that lets you
7+ You can find an example <https://github.com/haskell-servant/servant/blob/master/servant-jquery/examples/counter.hs here>
8+ which serves the generated javascript to a webpage that allows you to trigger
8− trigger webservice calls.
9+ webservice calls.
10+ .
11+ <https://github.com/haskell-servant/servant/blob/master/servant-jquery/CHANGELOG.md CHANGELOG>
9license: BSD3
12license: BSD3
10license-file: LICENSE
13license-file: LICENSE
11author: Alp Mestanogullari
14author: Alp Mestanogullari
@@ -15,13 +18,13 @@ category: Web
15build-type: Simple
18build-type: Simple
16cabal-version: >=1.10
19cabal-version: >=1.10
17homepage: http://haskell-servant.github.io/
20homepage: http://haskell-servant.github.io/
18−Bug-reports: http://github.com/haskell-servant/servant-jquery/issues
21+Bug-reports: http://github.com/haskell-servant/servant/issues
19extra-source-files:
22extra-source-files:
20 CHANGELOG.md
23 CHANGELOG.md
21 README.md
24 README.md
22source-repository head
25source-repository head
23 type: git
26 type: git
24− location: http://github.com/haskell-servant/servant-jquery.git
27+ location: http://github.com/haskell-servant/servant.git
25
28
26flag example
29flag example
27 description: Build the example too
30 description: Build the example too
servant-jquery/src/Servant/JQuery/Internal.hs+11−8
@@ -1,15 +1,18 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE CPP #-}
2−{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE ConstraintKinds #-}
3−{-# LANGUAGE TypeOperators #-}
3+{-# LANGUAGE DataKinds #-}
4−{-# LANGUAGE ConstraintKinds #-}
5−{-# LANGUAGE TemplateHaskell #-}
6−{-# LANGUAGE FlexibleContexts #-}
4+{-# LANGUAGE FlexibleContexts #-}
7−{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE FlexibleInstances #-}
8−{-# LANGUAGE ScopedTypeVariables #-}
6+{-# LANGUAGE ScopedTypeVariables #-}
7+{-# LANGUAGE TemplateHaskell #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE UndecidableInstances #-}
10{-# LANGUAGE UndecidableInstances #-}
10module Servant.JQuery.Internal where
11module Servant.JQuery.Internal where
11
12
13+#if !MIN_VERSION_base(4,8,0)
12import Control.Applicative
14import Control.Applicative
15+#endif
13import Control.Lens
16import Control.Lens
14import Data.Char (toLower)
17import Data.Char (toLower)
15import qualified Data.CharSet as Set
18import qualified Data.CharSet as Set
servant-server/README.md+4−7
@@ -1,8 +1,5 @@
1# servant-server
1# servant-server
2
2
3−[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-server.svg)](http://travis-ci.org/haskell-servant/servant-server)
4−[![Coverage Status](https://coveralls.io/repos/haskell-servant/servant-server/badge.svg)](https://coveralls.io/r/haskell-servant/servant-server)
5−
6![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
3![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
7
4
8This library lets you *implement* an HTTP server with handlers for each endpoint of a servant API, handling most of the boilerplate for you.
5This library lets you *implement* an HTTP server with handlers for each endpoint of a servant API, handling most of the boilerplate for you.
@@ -14,7 +11,7 @@ We've written a [Getting Started](http://haskell-servant.github.io/getting-start
14## Repositories and Haddocks
11## Repositories and Haddocks
15
12
16- The core [servant](http://github.com/haskell-servant) package - [docs](http://hackage.haskell.org/package/servant)
13- The core [servant](http://github.com/haskell-servant) package - [docs](http://hackage.haskell.org/package/servant)
17−- Implementing an HTTP server for a webservice API with [servant-server](http://github.com/haskell-servant/servant-server) - [docs](http://hackage.haskell.org/package/servant-server)
14+- Implementing an HTTP server for a webservice API with [servant-server](http://github.com/haskell-servant/servant/tree/master/servant-server) - [docs](http://hackage.haskell.org/package/servant-server)
18−- (Haskell) client-side function generation with [servant-client](http://github.com/haskell-servant/servant-client) - [docs](http://hackage.haskell.org/package/servant-client)
15+- (Haskell) client-side function generation with [servant-client](http://github.com/haskell-servant/servant/tree/master/servant-client) - [docs](http://hackage.haskell.org/package/servant-client)
19−- (Javascript) client-side function generation with [servant-jquery](http://github.com/haskell-servant/servant-jquery) - [docs](http://hackage.haskell.org/package/servant-jquery)
16+- (Javascript) client-side function generation with [servant-jquery](http://github.com/haskell-servant/servant/tree/master/servant-jquery) - [docs](http://hackage.haskell.org/package/servant-jquery)
20−- API docs generation with [servant-docs](http://github.com/haskell-servant/servant-docs) - [docs](http://hackage.haskell.org/package/servant-docs)
17+- API docs generation with [servant-docs](http://github.com/haskell-servant/servant/tree/master/servant-docs) - [docs](http://hackage.haskell.org/package/servant-docs)
servant-server/default.nix+26−13
@@ -1,15 +1,28 @@
1−{ pkgs ? import <nixpkgs> { config.allowUnfree = true; }
1+{ mkDerivation, aeson, attoparsec, base, bytestring
2−, src ? builtins.filterSource (path: type:
2+, bytestring-conversion, directory, either, exceptions, hspec
3− type != "unknown" &&
3+, hspec-wai, http-types, network, network-uri, parsec, QuickCheck
4− baseNameOf path != ".git" &&
4+, safe, servant, split, stdenv, string-conversions, system-filepath
5− baseNameOf path != "result" &&
5+, temporary, text, transformers, wai, wai-app-static, wai-extra
6− baseNameOf path != "dist") ./.
6+, warp
7−, servant ? import ../servant {}
8}:
7}:
9−pkgs.haskellPackages.buildLocalCabalWithArgs {
8+mkDerivation {
10− name = "servant-server";
9+ pname = "servant-server";
10+ version = "0.2.4";
11− inherit src;
11+ src = ./.;
12− args = {
12+ isLibrary = true;
13− inherit servant;
13+ isExecutable = true;
14− };
14+ buildDepends = [
15+ aeson attoparsec base bytestring either http-types network-uri safe
16+ servant split string-conversions system-filepath text transformers
17+ wai wai-app-static warp
18+ ];
19+ testDepends = [
20+ aeson base bytestring bytestring-conversion directory either
21+ exceptions hspec hspec-wai http-types network parsec QuickCheck
22+ servant string-conversions temporary text transformers wai
23+ wai-extra warp
24+ ];
25+ homepage = "http://haskell-servant.github.io/";
26+ description = "A family of combinators for defining webservices APIs and serving them";
27+ license = stdenv.lib.licenses.bsd3;
15}
28}
servant-server/servant-server.cabal+8−4
@@ -4,12 +4,16 @@ synopsis: A family of combinators for defining webservices APIs and s
4description:
4description:
5 A family of combinators for defining webservices APIs and serving them
5 A family of combinators for defining webservices APIs and serving them
6 .
6 .
7− You can learn about the basics in <http://haskell-servant.github.io/getting-started/ the getting started> guide.
7+ You can learn about the basics in <http://haskell-servant.github.io/getting-started/ the getting started>
8+ guide.
8 .
9 .
9− <https://github.com/haskell-servant/servant-server/blob/master/example/greet.hs Here>'s a runnable example, with comments, that defines a dummy API and
10+ <https://github.com/haskell-servant/servant/blob/master/servant-server/example/greet.hs Here>
11+ is a runnable example, with comments, that defines a dummy API and implements
10− implements a webserver that serves this API, using this package.
12+ a webserver that serves this API, using this package.
13+ .
14+ <https://github.com/haskell-servant/servant/blob/master/servant-server/CHANGELOG.md CHANGELOG>
11homepage: http://haskell-servant.github.io/
15homepage: http://haskell-servant.github.io/
12−Bug-reports: http://github.com/haskell-servant/servant-server/issues
16+Bug-reports: http://github.com/haskell-servant/servant/issues
13license: BSD3
17license: BSD3
14license-file: LICENSE
18license-file: LICENSE
15author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
19author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
servant-server/src/Servant/Server/Internal.hs+99−28
@@ -1,22 +1,28 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE FlexibleInstances #-}
4−{-# LANGUAGE OverlappingInstances #-}
5{-# LANGUAGE OverloadedStrings #-}
5{-# LANGUAGE OverloadedStrings #-}
6{-# LANGUAGE PolyKinds #-}
6{-# LANGUAGE PolyKinds #-}
7{-# LANGUAGE ScopedTypeVariables #-}
7{-# LANGUAGE ScopedTypeVariables #-}
8{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE TypeOperators #-}
10+#if !MIN_VERSION_base(4,8,0)
11+{-# LANGUAGE OverlappingInstances #-}
12+#endif
13+
10module Servant.Server.Internal where
14module Servant.Server.Internal where
11
15
16+#if !MIN_VERSION_base(4,8,0)
12import Control.Applicative ((<$>))
17import Control.Applicative ((<$>))
18+import Data.Monoid (Monoid, mappend, mempty)
19+#endif
13import Control.Monad.Trans.Either (EitherT, runEitherT)
20import Control.Monad.Trans.Either (EitherT, runEitherT)
14import qualified Data.ByteString as B
21import qualified Data.ByteString as B
15import qualified Data.ByteString.Lazy as BL
22import qualified Data.ByteString.Lazy as BL
16import Data.IORef (newIORef, readIORef, writeIORef)
23import Data.IORef (newIORef, readIORef, writeIORef)
17import Data.List (unfoldr)
24import Data.List (unfoldr)
18import Data.Maybe (catMaybes, fromMaybe)
25import Data.Maybe (catMaybes, fromMaybe)
19−import Data.Monoid (Monoid, mappend, mempty)
20import Data.String (fromString)
26import Data.String (fromString)
21import Data.String.Conversions (cs, (<>))
27import Data.String.Conversions (cs, (<>))
22import Data.Text (Text)
28import Data.Text (Text)
@@ -278,10 +284,13 @@ instance HasServer Delete where
278-- If successfully returning a value, we use the type-level list, combined
284-- If successfully returning a value, we use the type-level list, combined
279-- with the request's @Accept@ header, to encode the value for you
285-- with the request's @Accept@ header, to encode the value for you
280-- (returning a status code of 200). If there was no @Accept@ header or it
286-- (returning a status code of 200). If there was no @Accept@ header or it
281−-- was @*/*@, we return encode using the first @Content-Type@ type on the
287+-- was @*\/\*@, we return encode using the first @Content-Type@ type on the
282-- list.
288-- list.
283−instance ( AllCTRender ctypes a
289+instance
290+#if MIN_VERSION_base(4,8,0)
291+ {-# OVERLAPPABLE #-}
292+#endif
284− ) => HasServer (Get ctypes a) where
293+ ( AllCTRender ctypes a ) => HasServer (Get ctypes a) where
285
294
286 type ServerT' (Get ctypes a) m = m a
295 type ServerT' (Get ctypes a) m = m a
287
296
@@ -290,7 +299,7 @@ instance ( AllCTRender ctypes a
290 e <- runEitherT action
299 e <- runEitherT action
291 respond $ case e of
300 respond $ case e of
292 Right output -> do
301 Right output -> do
293− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
302+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
294 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
303 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
295 Nothing -> failWith UnsupportedMediaType
304 Nothing -> failWith UnsupportedMediaType
296 Just (contentT, body) -> succeedWith $
305 Just (contentT, body) -> succeedWith $
@@ -302,8 +311,14 @@ instance ( AllCTRender ctypes a
302 | otherwise = respond $ failWith NotFound
311 | otherwise = respond $ failWith NotFound
303
312
304-- '()' ==> 204 No Content
313-- '()' ==> 204 No Content
314+instance
315+#if MIN_VERSION_base(4,8,0)
316+ {-# OVERLAPPING #-}
317+#endif
305−instance HasServer (Get ctypes ()) where
318+ HasServer (Get ctypes ()) where
319+
306 type ServerT' (Get ctypes ()) m = m ()
320 type ServerT' (Get ctypes ()) m = m ()
321+
307 route Proxy action request respond
322 route Proxy action request respond
308 | pathIsEmpty request && requestMethod request == methodGet = do
323 | pathIsEmpty request && requestMethod request == methodGet = do
309 e <- runEitherT action
324 e <- runEitherT action
@@ -316,14 +331,20 @@ instance HasServer (Get ctypes ()) where
316 | otherwise = respond $ failWith NotFound
331 | otherwise = respond $ failWith NotFound
317
332
318-- Add response headers
333-- Add response headers
334+instance
335+#if MIN_VERSION_base(4,8,0)
336+ {-# OVERLAPPING #-}
337+#endif
319−instance ( AllCTRender ctypes v ) => HasServer (Get ctypes (Headers h v)) where
338+ ( AllCTRender ctypes v ) => HasServer (Get ctypes (Headers h v)) where
339+
320 type ServerT' (Get ctypes (Headers h v)) m = m (Headers h v)
340 type ServerT' (Get ctypes (Headers h v)) m = m (Headers h v)
341+
321 route Proxy action request respond
342 route Proxy action request respond
322 | pathIsEmpty request && requestMethod request == methodGet = do
343 | pathIsEmpty request && requestMethod request == methodGet = do
323 e <- runEitherT action
344 e <- runEitherT action
324 respond $ case e of
345 respond $ case e of
325 Right output -> do
346 Right output -> do
326− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
347+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
327 headers = getHeaders output
348 headers = getHeaders output
328 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse output) of
349 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse output) of
329 Nothing -> failWith UnsupportedMediaType
350 Nothing -> failWith UnsupportedMediaType
@@ -378,9 +399,13 @@ instance (KnownSymbol sym, FromText a, HasServer sublayout)
378-- If successfully returning a value, we use the type-level list, combined
399-- If successfully returning a value, we use the type-level list, combined
379-- with the request's @Accept@ header, to encode the value for you
400-- with the request's @Accept@ header, to encode the value for you
380-- (returning a status code of 201). If there was no @Accept@ header or it
401-- (returning a status code of 201). If there was no @Accept@ header or it
381−-- was @*/*@, we return encode using the first @Content-Type@ type on the
402+-- was @*\/\*@, we return encode using the first @Content-Type@ type on the
382-- list.
403-- list.
404+instance
405+#if MIN_VERSION_base(4,8,0)
406+ {-# OVERLAPPABLE #-}
407+#endif
383−instance ( AllCTRender ctypes a
408+ ( AllCTRender ctypes a
384 ) => HasServer (Post ctypes a) where
409 ) => HasServer (Post ctypes a) where
385
410
386 type ServerT' (Post ctypes a) m = m a
411 type ServerT' (Post ctypes a) m = m a
@@ -390,7 +415,7 @@ instance ( AllCTRender ctypes a
390 e <- runEitherT action
415 e <- runEitherT action
391 respond $ case e of
416 respond $ case e of
392 Right output -> do
417 Right output -> do
393− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
418+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
394 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
419 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
395 Nothing -> failWith UnsupportedMediaType
420 Nothing -> failWith UnsupportedMediaType
396 Just (contentT, body) -> succeedWith $
421 Just (contentT, body) -> succeedWith $
@@ -401,8 +426,14 @@ instance ( AllCTRender ctypes a
401 respond $ failWith WrongMethod
426 respond $ failWith WrongMethod
402 | otherwise = respond $ failWith NotFound
427 | otherwise = respond $ failWith NotFound
403
428
429+instance
430+#if MIN_VERSION_base(4,8,0)
431+ {-# OVERLAPPING #-}
432+#endif
404−instance HasServer (Post ctypes ()) where
433+ HasServer (Post ctypes ()) where
434+
405 type ServerT' (Post ctypes ()) m = m ()
435 type ServerT' (Post ctypes ()) m = m ()
436+
406 route Proxy action request respond
437 route Proxy action request respond
407 | pathIsEmpty request && requestMethod request == methodPost = do
438 | pathIsEmpty request && requestMethod request == methodPost = do
408 e <- runEitherT action
439 e <- runEitherT action
@@ -415,14 +446,20 @@ instance HasServer (Post ctypes ()) where
415 | otherwise = respond $ failWith NotFound
446 | otherwise = respond $ failWith NotFound
416
447
417-- Add response headers
448-- Add response headers
449+instance
450+#if MIN_VERSION_base(4,8,0)
451+ {-# OVERLAPPING #-}
452+#endif
418−instance ( AllCTRender ctypes v ) => HasServer (Post ctypes (Headers h v)) where
453+ ( AllCTRender ctypes v ) => HasServer (Post ctypes (Headers h v)) where
454+
419 type ServerT' (Post ctypes (Headers h v)) m = m (Headers h v)
455 type ServerT' (Post ctypes (Headers h v)) m = m (Headers h v)
456+
420 route Proxy action request respond
457 route Proxy action request respond
421 | pathIsEmpty request && requestMethod request == methodPost = do
458 | pathIsEmpty request && requestMethod request == methodPost = do
422 e <- runEitherT action
459 e <- runEitherT action
423 respond $ case e of
460 respond $ case e of
424 Right output -> do
461 Right output -> do
425− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
462+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
426 headers = getHeaders output
463 headers = getHeaders output
427 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse output) of
464 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse output) of
428 Nothing -> failWith UnsupportedMediaType
465 Nothing -> failWith UnsupportedMediaType
@@ -445,10 +482,13 @@ instance ( AllCTRender ctypes v ) => HasServer (Post ctypes (Headers h v)) where
445-- If successfully returning a value, we use the type-level list, combined
482-- If successfully returning a value, we use the type-level list, combined
446-- with the request's @Accept@ header, to encode the value for you
483-- with the request's @Accept@ header, to encode the value for you
447-- (returning a status code of 200). If there was no @Accept@ header or it
484-- (returning a status code of 200). If there was no @Accept@ header or it
448−-- was @*/*@, we return encode using the first @Content-Type@ type on the
485+-- was @*\/\*@, we return encode using the first @Content-Type@ type on the
449-- list.
486-- list.
450−instance ( AllCTRender ctypes a
487+instance
488+#if MIN_VERSION_base(4,8,0)
489+ {-# OVERLAPPABLE #-}
490+#endif
451− ) => HasServer (Put ctypes a) where
491+ ( AllCTRender ctypes a) => HasServer (Put ctypes a) where
452
492
453 type ServerT' (Put ctypes a) m = m a
493 type ServerT' (Put ctypes a) m = m a
454
494
@@ -457,7 +497,7 @@ instance ( AllCTRender ctypes a
457 e <- runEitherT action
497 e <- runEitherT action
458 respond $ case e of
498 respond $ case e of
459 Right output -> do
499 Right output -> do
460− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
500+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
461 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
501 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
462 Nothing -> failWith UnsupportedMediaType
502 Nothing -> failWith UnsupportedMediaType
463 Just (contentT, body) -> succeedWith $
503 Just (contentT, body) -> succeedWith $
@@ -468,8 +508,14 @@ instance ( AllCTRender ctypes a
468 respond $ failWith WrongMethod
508 respond $ failWith WrongMethod
469 | otherwise = respond $ failWith NotFound
509 | otherwise = respond $ failWith NotFound
470
510
511+instance
512+#if MIN_VERSION_base(4,8,0)
513+ {-# OVERLAPPING #-}
514+#endif
471−instance HasServer (Put ctypes ()) where
515+ HasServer (Put ctypes ()) where
516+
472 type ServerT' (Put ctypes ()) m = m ()
517 type ServerT' (Put ctypes ()) m = m ()
518+
473 route Proxy action request respond
519 route Proxy action request respond
474 | pathIsEmpty request && requestMethod request == methodPut = do
520 | pathIsEmpty request && requestMethod request == methodPut = do
475 e <- runEitherT action
521 e <- runEitherT action
@@ -482,14 +528,20 @@ instance HasServer (Put ctypes ()) where
482 | otherwise = respond $ failWith NotFound
528 | otherwise = respond $ failWith NotFound
483
529
484-- Add response headers
530-- Add response headers
531+instance
532+#if MIN_VERSION_base(4,8,0)
533+ {-# OVERLAPPING #-}
534+#endif
485−instance ( AllCTRender ctypes v ) => HasServer (Put ctypes (Headers h v)) where
535+ ( AllCTRender ctypes v ) => HasServer (Put ctypes (Headers h v)) where
536+
486 type ServerT' (Put ctypes (Headers h v)) m = m (Headers h v)
537 type ServerT' (Put ctypes (Headers h v)) m = m (Headers h v)
538+
487 route Proxy action request respond
539 route Proxy action request respond
488 | pathIsEmpty request && requestMethod request == methodPut = do
540 | pathIsEmpty request && requestMethod request == methodPut = do
489 e <- runEitherT action
541 e <- runEitherT action
490 respond $ case e of
542 respond $ case e of
491 Right output -> do
543 Right output -> do
492− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
544+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
493 headers = getHeaders output
545 headers = getHeaders output
494 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse output) of
546 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse output) of
495 Nothing -> failWith UnsupportedMediaType
547 Nothing -> failWith UnsupportedMediaType
@@ -512,8 +564,12 @@ instance ( AllCTRender ctypes v ) => HasServer (Put ctypes (Headers h v)) where
512-- If successfully returning a value, we just require that its type has
564-- If successfully returning a value, we just require that its type has
513-- a 'ToJSON' instance and servant takes care of encoding it for you,
565-- a 'ToJSON' instance and servant takes care of encoding it for you,
514-- yielding status code 200 along the way.
566-- yielding status code 200 along the way.
515−instance ( AllCTRender ctypes a
567+instance
568+#if MIN_VERSION_base(4,8,0)
569+ {-# OVERLAPPABLE #-}
570+#endif
516− ) => HasServer (Patch ctypes a) where
571+ ( AllCTRender ctypes a) => HasServer (Patch ctypes a) where
572+
517 type ServerT' (Patch ctypes a) m = m a
573 type ServerT' (Patch ctypes a) m = m a
518
574
519 route Proxy action request respond
575 route Proxy action request respond
@@ -521,7 +577,7 @@ instance ( AllCTRender ctypes a
521 e <- runEitherT action
577 e <- runEitherT action
522 respond $ case e of
578 respond $ case e of
523 Right output -> do
579 Right output -> do
524− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
580+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
525 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
581 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) output of
526 Nothing -> failWith UnsupportedMediaType
582 Nothing -> failWith UnsupportedMediaType
527 Just (contentT, body) -> succeedWith $
583 Just (contentT, body) -> succeedWith $
@@ -532,8 +588,14 @@ instance ( AllCTRender ctypes a
532 respond $ failWith WrongMethod
588 respond $ failWith WrongMethod
533 | otherwise = respond $ failWith NotFound
589 | otherwise = respond $ failWith NotFound
534
590
591+instance
592+#if MIN_VERSION_base(4,8,0)
593+ {-# OVERLAPPING #-}
594+#endif
535−instance HasServer (Patch ctypes ()) where
595+ HasServer (Patch ctypes ()) where
596+
536 type ServerT' (Patch ctypes ()) m = m ()
597 type ServerT' (Patch ctypes ()) m = m ()
598+
537 route Proxy action request respond
599 route Proxy action request respond
538 | pathIsEmpty request && requestMethod request == methodPatch = do
600 | pathIsEmpty request && requestMethod request == methodPatch = do
539 e <- runEitherT action
601 e <- runEitherT action
@@ -546,14 +608,20 @@ instance HasServer (Patch ctypes ()) where
546 | otherwise = respond $ failWith NotFound
608 | otherwise = respond $ failWith NotFound
547
609
548-- Add response headers
610-- Add response headers
611+instance
612+#if MIN_VERSION_base(4,8,0)
613+ {-# OVERLAPPING #-}
614+#endif
549−instance ( AllCTRender ctypes v ) => HasServer (Patch ctypes (Headers h v)) where
615+ ( AllCTRender ctypes v ) => HasServer (Patch ctypes (Headers h v)) where
616+
550 type ServerT' (Patch ctypes (Headers h v)) m = m (Headers h v)
617 type ServerT' (Patch ctypes (Headers h v)) m = m (Headers h v)
618+
551 route Proxy action request respond
619 route Proxy action request respond
552 | pathIsEmpty request && requestMethod request == methodPatch = do
620 | pathIsEmpty request && requestMethod request == methodPatch = do
553 e <- runEitherT action
621 e <- runEitherT action
554 respond $ case e of
622 respond $ case e of
555 Right outpatch -> do
623 Right outpatch -> do
556− let accH = fromMaybe "*/*" $ lookup hAccept $ requestHeaders request
624+ let accH = fromMaybe ct_wildcard $ lookup hAccept $ requestHeaders request
557 headers = getHeaders outpatch
625 headers = getHeaders outpatch
558 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse outpatch) of
626 case handleAcceptH (Proxy :: Proxy ctypes) (AcceptHeader accH) (getResponse outpatch) of
559 Nothing -> failWith UnsupportedMediaType
627 Nothing -> failWith UnsupportedMediaType
@@ -864,3 +932,6 @@ instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout
864 _ -> respond $ failWith NotFound
932 _ -> respond $ failWith NotFound
865
933
866 where proxyPath = Proxy :: Proxy path
934 where proxyPath = Proxy :: Proxy path
935+
936+ct_wildcard :: B.ByteString
937+ct_wildcard = "*" <> "/" <> "*" -- Because CPP
servant/servant.png → servant.pngrenamed

Binary file not shown.

servant/default.nix+20−10
@@ -1,12 +1,22 @@
1−{ pkgs ? import <nixpkgs> { config.allowUnfree = true; }
1+{ mkDerivation, aeson, attoparsec, base, bytestring
2−, src ? builtins.filterSource (path: type:
2+, bytestring-conversion, case-insensitive, doctest, filemanip
3− type != "unknown" &&
3+, hspec, http-media, http-types, network-uri, parsec, QuickCheck
4− baseNameOf path != ".git" &&
4+, quickcheck-instances, stdenv, string-conversions, text, url
5− baseNameOf path != "result" &&
6− baseNameOf path != "dist") ./.
7}:
5}:
8−pkgs.haskellPackages.buildLocalCabalWithArgs {
6+mkDerivation {
9− name = "servant";
7+ pname = "servant";
8+ version = "0.2.2";
10− inherit src;
9+ src = ./.;
11− args = {};
10+ buildDepends = [
11+ aeson attoparsec base bytestring bytestring-conversion
12+ case-insensitive http-media http-types network-uri
13+ string-conversions text
14+ ];
15+ testDepends = [
16+ aeson attoparsec base bytestring doctest filemanip hspec parsec
17+ QuickCheck quickcheck-instances string-conversions text url
18+ ];
19+ homepage = "http://haskell-servant.github.io/";
20+ description = "A family of combinators for defining webservices APIs";
21+ license = stdenv.lib.licenses.bsd3;
12}
22}
servant/servant.cabal+4−3
@@ -8,6 +8,8 @@ description:
8 .
8 .
9 <https://github.com/haskell-servant/servant-server/blob/master/example/greet.hs Here>'s a runnable example, with comments, that defines a dummy API and
9 <https://github.com/haskell-servant/servant-server/blob/master/example/greet.hs Here>'s a runnable example, with comments, that defines a dummy API and
10 implements a webserver that serves this API, using the <http://hackage.haskell.org/package/servant-server servant-server> package.
10 implements a webserver that serves this API, using the <http://hackage.haskell.org/package/servant-server servant-server> package.
11+ .
12+ <https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md CHANGELOG>
11homepage: http://haskell-servant.github.io/
13homepage: http://haskell-servant.github.io/
12Bug-reports: http://github.com/haskell-servant/servant/issues
14Bug-reports: http://github.com/haskell-servant/servant/issues
13license: BSD3
15license: BSD3
@@ -53,13 +55,12 @@ library
53 , http-media >= 0.4 && < 0.7
55 , http-media >= 0.4 && < 0.7
54 , http-types == 0.8.*
56 , http-types == 0.8.*
55 , text >= 1 && < 2
57 , text >= 1 && < 2
56− , template-haskell >= 2.7 && < 2.10
57− , parsec >= 3.1
58 , string-conversions >= 0.3 && < 0.4
58 , string-conversions >= 0.3 && < 0.4
59 , network-uri >= 2.6
59 , network-uri >= 2.6
60 hs-source-dirs: src
60 hs-source-dirs: src
61 default-language: Haskell2010
61 default-language: Haskell2010
62+ other-extensions: CPP
62− other-extensions: ConstraintKinds
63+ , ConstraintKinds
63 , DataKinds
64 , DataKinds
64 , DeriveDataTypeable
65 , DeriveDataTypeable
65 , FlexibleInstances
66 , FlexibleInstances
servant/src/Servant/API/Alternative.hs+3
@@ -1,8 +1,11 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE TypeOperators #-}
3{-# LANGUAGE TypeOperators #-}
3module Servant.API.Alternative ((:<|>)(..)) where
4module Servant.API.Alternative ((:<|>)(..)) where
4
5
6+#if !MIN_VERSION_base(4,8,0)
5import Data.Monoid (Monoid (..))
7import Data.Monoid (Monoid (..))
8+#endif
6import Data.Typeable (Typeable)
9import Data.Typeable (Typeable)
7-- | Union of two APIs, first takes precedence in case of overlap.
10-- | Union of two APIs, first takes precedence in case of overlap.
8--
11--
servant/src/Servant/API/ContentTypes.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveDataTypeable #-}
4{-# LANGUAGE DeriveDataTypeable #-}
@@ -63,7 +64,9 @@ module Servant.API.ContentTypes
63 , eitherDecodeLenient
64 , eitherDecodeLenient
64 ) where
65 ) where
65
66
67+#if !MIN_VERSION_base(4,8,0)
66import Control.Applicative ((<*))
68import Control.Applicative ((<*))
69+#endif
67import Control.Arrow (left)
70import Control.Arrow (left)
68import Control.Monad
71import Control.Monad
69import Data.Aeson (FromJSON, ToJSON, Value,
72import Data.Aeson (FromJSON, ToJSON, Value,
servant/src/Servant/API/ResponseHeaders.hs+14−3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveFunctor #-}
3{-# LANGUAGE DeriveFunctor #-}
3{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleContexts #-}
@@ -6,11 +7,13 @@
6{-# LANGUAGE GADTs #-}
7{-# LANGUAGE GADTs #-}
7{-# LANGUAGE KindSignatures #-}
8{-# LANGUAGE KindSignatures #-}
8{-# LANGUAGE MultiParamTypeClasses #-}
9{-# LANGUAGE MultiParamTypeClasses #-}
9−{-# LANGUAGE OverlappingInstances #-}
10{-# LANGUAGE PolyKinds #-}
10{-# LANGUAGE PolyKinds #-}
11{-# LANGUAGE ScopedTypeVariables #-}
11{-# LANGUAGE ScopedTypeVariables #-}
12{-# LANGUAGE TypeOperators #-}
12{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE UndecidableInstances #-}
13{-# LANGUAGE UndecidableInstances #-}
14+#if !MIN_VERSION_base(4,8,0)
15+{-# LANGUAGE OverlappingInstances #-}
16+#endif
14
17
15-- | This module provides facilities for adding headers to a response.
18-- | This module provides facilities for adding headers to a response.
16--
19--
@@ -50,13 +53,21 @@ class AddHeader h v orig new
50 | h v orig -> new, new -> h, new -> v, new -> orig where
53 | h v orig -> new, new -> h, new -> v, new -> orig where
51 addHeader :: v -> orig -> new
54 addHeader :: v -> orig -> new
52
55
56+instance
57+#if MIN_VERSION_base(4,8,0)
58+ {-# OVERLAPPING #-}
59+#endif
53−instance ( KnownSymbol h, ToByteString v
60+ ( KnownSymbol h, ToByteString v
54 ) => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': fst ': rest) a) where
61 ) => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': fst ': rest) a) where
55 addHeader a (Headers resp heads) = Headers resp ((headerName, toByteString' a) : heads)
62 addHeader a (Headers resp heads) = Headers resp ((headerName, toByteString' a) : heads)
56 where
63 where
57 headerName = CI.mk . pack $ symbolVal (Proxy :: Proxy h)
64 headerName = CI.mk . pack $ symbolVal (Proxy :: Proxy h)
58
65
66+instance
67+#if MIN_VERSION_base(4,8,0)
68+ {-# OVERLAPPABLE #-}
69+#endif
59−instance ( KnownSymbol h, ToByteString v
70+ ( KnownSymbol h, ToByteString v
60 , new ~ (Headers '[Header h v] a)
71 , new ~ (Headers '[Header h v] a)
61 ) => AddHeader h v a new where
72 ) => AddHeader h v a new where
62 addHeader a resp = Headers resp [(headerName, toByteString' a)]
73 addHeader a resp = Headers resp [(headerName, toByteString' a)]
servant/src/Servant/Common/Text.hs+8−1
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE TypeSynonymInstances #-}
4{-# LANGUAGE TypeSynonymInstances #-}
@@ -6,12 +7,18 @@ module Servant.Common.Text
6 , ToText(..)
7 , ToText(..)
7 ) where
8 ) where
8
9
10+#if !MIN_VERSION_base(4,8,0)
9import Control.Applicative ((<$>))
11import Control.Applicative ((<$>))
12+#endif
10import Data.Int (Int16, Int32, Int64, Int8)
13import Data.Int (Int16, Int32, Int64, Int8)
11import Data.String.Conversions (cs)
14import Data.String.Conversions (cs)
12import Data.Text (Text)
15import Data.Text (Text)
13import Data.Text.Read (Reader, decimal, rational, signed)
16import Data.Text.Read (Reader, decimal, rational, signed)
14−import Data.Word (Word, Word16, Word32, Word64, Word8)
17+import Data.Word (Word16, Word32, Word64, Word8
18+#if !MIN_VERSION_base(4,8,0)
19+ , Word
20+#endif
21+ )
15
22
16-- | For getting values from url captures and query string parameters
23-- | For getting values from url captures and query string parameters
17-- Instances should obey:
24-- Instances should obey:
servant/src/Servant/Utils/Links.hs+13−9
@@ -1,13 +1,13 @@
1−{-# LANGUAGE PolyKinds #-}
1+{-# LANGUAGE CPP #-}
2−{-# LANGUAGE ConstraintKinds #-}
2+{-# LANGUAGE ConstraintKinds #-}
3−{-# LANGUAGE DataKinds #-}
3+{-# LANGUAGE DataKinds #-}
4−{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE FlexibleInstances #-}
5{-# LANGUAGE FunctionalDependencies #-}
5{-# LANGUAGE FunctionalDependencies #-}
6−{-# LANGUAGE PolyKinds #-}
6+{-# LANGUAGE PolyKinds #-}
7−{-# LANGUAGE ScopedTypeVariables #-}
7+{-# LANGUAGE ScopedTypeVariables #-}
8−{-# LANGUAGE TypeFamilies #-}
8+{-# LANGUAGE TypeFamilies #-}
9−{-# LANGUAGE TypeOperators #-}
9+{-# LANGUAGE TypeOperators #-}
10−{-# LANGUAGE UndecidableInstances #-}
10+{-# LANGUAGE UndecidableInstances #-}
11
11
12-- | Type safe generation of internal links.
12-- | Type safe generation of internal links.
13--
13--
@@ -104,7 +104,11 @@ module Servant.Utils.Links (
104import Data.List
104import Data.List
105import Data.Proxy ( Proxy(..) )
105import Data.Proxy ( Proxy(..) )
106import Data.Text (Text, unpack)
106import Data.Text (Text, unpack)
107+#if !MIN_VERSION_base(4,8,0)
107import Data.Monoid ( Monoid(..), (<>) )
108import Data.Monoid ( Monoid(..), (<>) )
109+#else
110+import Data.Monoid ( (<>) )
111+#endif
108import Network.URI ( URI(..), escapeURIString, isUnreserved )
112import Network.URI ( URI(..), escapeURIString, isUnreserved )
109import GHC.TypeLits ( KnownSymbol, symbolVal )
113import GHC.TypeLits ( KnownSymbol, symbolVal )
110import GHC.Exts(Constraint)
114import GHC.Exts(Constraint)
servant/test/Servant/API/ContentTypesSpec.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
@@ -5,7 +6,9 @@
5{-# OPTIONS_GHC -fno-warn-orphans #-}
6{-# OPTIONS_GHC -fno-warn-orphans #-}
6module Servant.API.ContentTypesSpec where
7module Servant.API.ContentTypesSpec where
7
8
9+#if !MIN_VERSION_base(4,8,0)
8import Control.Applicative
10import Control.Applicative
11+#endif
9import Control.Arrow
12import Control.Arrow
10import Data.Aeson
13import Data.Aeson
11import Data.Aeson.Parser (jstring)
14import Data.Aeson.Parser (jstring)
servant/test/Servant/Common/TextSpec.hs+6−1
@@ -1,8 +1,13 @@
1+{-# LANGUAGE CPP #-}
1module Servant.Common.TextSpec where
2module Servant.Common.TextSpec where
2
3
3import Data.Int (Int16, Int32, Int64, Int8)
4import Data.Int (Int16, Int32, Int64, Int8)
4import Data.Text (Text)
5import Data.Text (Text)
5−import Data.Word (Word, Word16, Word32, Word64, Word8)
6+import Data.Word (Word16, Word32, Word64, Word8
7+#if !MIN_VERSION_base(4,8,0)
8+ , Word
9+#endif
10+ )
6import Servant.Common.Text
11import Servant.Common.Text
7import Test.Hspec
12import Test.Hspec
8import Test.QuickCheck
13import Test.QuickCheck
sources.txtnew file+5
@@ -0,0 +1,5 @@
1+servant
2+servant-client
3+servant-docs
4+servant-jquery
5+servant-server