on a67cbbc help sign in
.gitignore+5−5
since splitsnapshots
unifiedsplit
@@ -1,8 +1,8 @@
1−dist
1+/dist
2−bin
2+/bin
3−lib
3+/lib
4−share
4+/share
5−packages
5+/packages
6*-packages.conf.d
6*-packages.conf.d
7cabal-dev
7cabal-dev
8add-source-timestamps
8add-source-timestamps
scripts/bump-versions.sh+8−21
@@ -16,33 +16,17 @@
16set -o nounset
16set -o nounset
17set -o errexit
17set -o errexit
18
18
19−DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
19+DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
20−DRY_RUN=false
20+. "${DIR}/scripts/lib/common.sh"
21−POSITION="none"
22−SOURCES_TXT="$( dirname $DIR)/sources.txt"
23−
24−declare -a SOURCES
25−readarray -t SOURCES < "$SOURCES_TXT"
26
21
27usage () {
22usage () {
28− echo " bump-versions <POSITION> [-d|--dry-run]"
23+ echo " bump-versions.sh <POSITION> [-d|--dry-run]"
29 echo " | [-h|--help]"
24 echo " | [-h|--help]"
30 echo " Bumps the specified positional version of all servant packages."
25 echo " Bumps the specified positional version of all servant packages."
31 echo " POSITION is a number between 0 and 3, inclusive."
26 echo " POSITION is a number between 0 and 3, inclusive."
32 exit 0
27 exit 0
33}
28}
34
29
35−join () { local IFS="$1"; shift; echo "$*"; }
36−
37−versions_equal () {
38− local NUM=$(find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
39− if [ 1 -eq $NUM ] ; then
40− return 0
41− else
42− echo "versions of packages are not all the same!" && exit 1
43− fi
44−}
45−
46if [ $# -eq 0 ] ; then
30if [ $# -eq 0 ] ; then
47 echo "expecting one or more arguments. Got 0"
31 echo "expecting one or more arguments. Got 0"
48 usage
32 usage
@@ -71,8 +55,11 @@ while [ "${1:-unset}" != "unset" ] ; do
71done
55done
72
56
73if $DRY_RUN ; then
57if $DRY_RUN ; then
58+ echo "Would have bumped position ${POSITION} on these packages:"
74− bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}")
59+ ( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}") )
75else
60else
76− bumper -"$POSITION" $(join , "${SOURCES[@]}")
61+ ( cd "$ROOT" && bumper -"$POSITION" $(join , "${SOURCES[@]}") )
77fi
62fi
78
63
64+# Trailing newline, bumper does not ship with its own.
65+echo
scripts/lib/common.shnew file+32
@@ -0,0 +1,32 @@
1+#!/bin/bash -
2+#===============================================================================
3+#
4+# FILE: lib/common.sh
5+#
6+# DESCRIPTION: Common functions for servant's shell scripts
7+# Meant to be sourced rather than run.
8+#
9+# REQUIREMENTS: bash >= 4
10+#===============================================================================
11+
12+
13+DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
14+ROOT=$( dirname $DIR )
15+DRY_RUN=false
16+POSITION="none"
17+SOURCES_TXT="$( dirname $DIR)/sources.txt"
18+CABAL=${CABAL:-cabal}
19+
20+declare -a SOURCES
21+readarray -t SOURCES < "$SOURCES_TXT"
22+
23+join () { local IFS="$1"; shift; echo "$*"; }
24+
25+versions_equal () {
26+ local NUM=$(cd "$ROOT" && find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
27+ if [ 1 -eq $NUM ] ; then
28+ return 0
29+ else
30+ echo "versions of packages are not all the same!" && exit 1
31+ fi
32+}
scripts/start-sandbox.sh+1−5
@@ -14,11 +14,7 @@ set -o nounset
14set -o errexit
14set -o errexit
15
15
16DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
16DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
17−SOURCES_TXT="$( dirname $DIR)/sources.txt"
17+. "$DIR"/lib/common.sh
18−CABAL=${CABAL:-cabal}
19−
20−declare -a SOURCES
21−readarray -t SOURCES < "$SOURCES_TXT"
22
18
23prepare_sandbox () {
19prepare_sandbox () {
24 $CABAL sandbox init
20 $CABAL sandbox init
scripts/test-all.sh+2−6
@@ -15,13 +15,9 @@ set -o nounset
15set -o errexit
15set -o errexit
16
16
17DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
17DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
18−GHC_FLAGS="-Werror"
18+. "$DIR"/lib/common.sh
19−SOURCES_TXT="$( dirname $DIR)/sources.txt"
20−CABAL=${CABAL:-cabal}
21−
22−declare -a SOURCES
23−readarray -t SOURCES < "$SOURCES_TXT"
24
19
20+GHC_FLAGS="-Werror"
25
21
26prepare_sandbox () {
22prepare_sandbox () {
27 $CABAL sandbox init
23 $CABAL sandbox init
scripts/update-defaults-nix.sh+1−5
@@ -12,11 +12,7 @@ set -o nounset
12set -o errexit
12set -o errexit
13
13
14DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
14DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
15−BASE_DIR="$( dirname $DIR)"
15+. "$DIR"/lib/common.sh
16−SOURCES_TXT="$BASE_DIR/sources.txt"
17−
18−declare -a SOURCES
19−readarray -t SOURCES < "$SOURCES_TXT"
20
16
21for s in ${SOURCES[@]} ; do
17for s in ${SOURCES[@]} ; do
22 echo $s
18 echo $s
scripts/upload.shnew file+52
@@ -0,0 +1,52 @@
1+#!/bin/bash -
2+#===============================================================================
3+#
4+# FILE: upload.sh
5+#
6+# USAGE: ./upload.sh <USER> <PASSWORD>
7+#
8+# DESCRIPTION: Uploads all servant packages to Hackage
9+#
10+# REQUIREMENTS: cabal, bash >= 4
11+# AUTHOR: Julian K. Arni
12+# CREATED: 05.06.2015 13:05
13+#===============================================================================
14+
15+set -o nounset
16+set -o errexit
17+
18+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
19+. "$DIR"/lib/common.sh
20+
21+usage () {
22+ echo " upload.sh <USER> <PASSWORD>"
23+ echo " Uploads all servant packages to Hackage"
24+ exit 0
25+}
26+
27+
28+upload_package () {
29+ local package="$1"
30+ local user="$2"
31+ local pass="$3"
32+ local cabalFile="$package.cabal"
33+ pushd "$package"
34+ local version=$(grep -i '^version:' $cabalFile | awk '{ print $2 }')
35+ local sdist="dist/${package}-${version}.tar.gz"
36+ cabal sdist
37+ echo "User is: $user"
38+ cabal upload --user="$user" --password="$pass" "$sdist"
39+ popd
40+}
41+
42+
43+if [ $# -ne 2 ] ; then
44+ echo "expecting two arguments."
45+ usage
46+fi
47+
48+versions_equal
49+
50+for s in ${SOURCES[@]} ; do
51+ upload_package "$s" "$1" "$2"
52+done
servant-blaze/servant-blaze.cabal+1−1
@@ -2,7 +2,7 @@
2-- documentation, see http://haskell.org/cabal/users-guide/
2-- documentation, see http://haskell.org/cabal/users-guide/
3
3
4name: servant-blaze
4name: servant-blaze
5−version: 0.4.1
5+version: 0.4.3
6synopsis: Blaze-html support for servant
6synopsis: Blaze-html support for servant
7-- description:
7-- description:
8homepage: http://haskell-servant.github.io/
8homepage: http://haskell-servant.github.io/
servant-client/servant-client.cabal+1−1
@@ -1,5 +1,5 @@
1name: servant-client
1name: servant-client
2−version: 0.4.1
2+version: 0.4.3
3synopsis: automatical derivation of querying functions for servant webservices
3synopsis: automatical derivation of querying functions for servant webservices
4description:
4description:
5 This library lets you derive automatically Haskell functions that
5 This library lets you derive automatically Haskell functions that
servant-docs/CHANGELOG.md+4
@@ -1,3 +1,7 @@
1+0.4.3
2+-----
3+* docsWith will no longer eat your documentation (https://github.com/haskell-servant/servant/pull/124)
4+
10.4
50.4
2---
6---
3* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body
7* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body
servant-docs/servant-docs.cabal+2−1
@@ -1,5 +1,5 @@
1name: servant-docs
1name: servant-docs
2−version: 0.4.1
2+version: 0.4.3
3synopsis: generate API docs for your servant webservice
3synopsis: generate API docs for your servant webservice
4description:
4description:
5 Library for generating API docs from a servant API definition.
5 Library for generating API docs from a servant API definition.
@@ -70,6 +70,7 @@ test-suite spec
70 base
70 base
71 , aeson
71 , aeson
72 , hspec
72 , hspec
73+ , lens
73 , servant
74 , servant
74 , servant-docs
75 , servant-docs
75 , string-conversions
76 , string-conversions
servant-docs/src/Servant/Docs/Internal.hs+1−1
@@ -338,7 +338,7 @@ extraInfo p action =
338docsWith :: HasDocs layout => [DocIntro] -> ExtraInfo layout -> Proxy layout -> API
338docsWith :: HasDocs layout => [DocIntro] -> ExtraInfo layout -> Proxy layout -> API
339docsWith intros (ExtraInfo endpoints) p =
339docsWith intros (ExtraInfo endpoints) p =
340 docs p & apiIntros <>~ intros
340 docs p & apiIntros <>~ intros
341− & apiEndpoints %~ HM.unionWith combineAction endpoints
341+ & apiEndpoints %~ HM.unionWith (flip combineAction) endpoints
342
342
343
343
344-- | Generate the docs for a given API that implements 'HasDocs' with with any
344-- | Generate the docs for a given API that implements 'HasDocs' with with any
servant-docs/test/Servant/DocsSpec.hs+26−3
@@ -7,7 +7,9 @@
7{-# OPTIONS_GHC -fno-warn-orphans #-}
7{-# OPTIONS_GHC -fno-warn-orphans #-}
8module Servant.DocsSpec where
8module Servant.DocsSpec where
9
9
10+import Control.Lens
10import Data.Aeson
11import Data.Aeson
12+import Data.Monoid
11import Data.Proxy
13import Data.Proxy
12import Data.String.Conversions (cs)
14import Data.String.Conversions (cs)
13import GHC.Generics
15import GHC.Generics
@@ -21,7 +23,27 @@ spec = describe "Servant.Docs" $ do
21
23
22 describe "markdown" $ do
24 describe "markdown" $ do
23 let md = markdown (docs (Proxy :: Proxy TestApi1))
25 let md = markdown (docs (Proxy :: Proxy TestApi1))
24−
26+ tests md
27+
28+ describe "markdown with extra info" $ do
29+ let
30+ extra = extraInfo
31+ (Proxy :: Proxy (Get '[JSON, PlainText] Int))
32+ (defAction & notes <>~ [DocNote "Get an Integer" ["get an integer in Json or plain text"]])
33+ <>
34+ extraInfo
35+ (Proxy :: Proxy (ReqBody '[JSON] String :> Post '[JSON] Datatype1))
36+ (defAction & notes <>~ [DocNote "Post data" ["Posts some Json data"]])
37+ md = markdown (docsWith [] extra (Proxy :: Proxy TestApi1))
38+ tests md
39+ it "contains the extra info provided" $ do
40+ md `shouldContain` "Get an Integer"
41+ md `shouldContain` "Post data"
42+ md `shouldContain` "get an integer in Json or plain text"
43+ md `shouldContain` "Posts some Json data"
44+
45+ where
46+ tests md = do
25 it "mentions supported content-types" $ do
47 it "mentions supported content-types" $ do
26 md `shouldContain` "application/json"
48 md `shouldContain` "application/json"
27 md `shouldContain` "text/plain;charset=utf-8"
49 md `shouldContain` "text/plain;charset=utf-8"
@@ -34,10 +56,11 @@ spec = describe "Servant.Docs" $ do
34 md `shouldContain` "POST"
56 md `shouldContain` "POST"
35 md `shouldContain` "GET"
57 md `shouldContain` "GET"
36
58
37− it "contains response samples" $ do
59+ it "contains response samples" $
38 md `shouldContain` "{\"dt1field1\":\"field 1\",\"dt1field2\":13}"
60 md `shouldContain` "{\"dt1field1\":\"field 1\",\"dt1field2\":13}"
39− it "contains request body samples" $ do
61+ it "contains request body samples" $
40 md `shouldContain` "17"
62 md `shouldContain` "17"
63+
41-- * APIs
64-- * APIs
42
65
43data Datatype1 = Datatype1 { dt1field1 :: String
66data Datatype1 = Datatype1 { dt1field1 :: String
servant-examples/CHANGELOG.mdnew file+3
@@ -0,0 +1,3 @@
1+0.4.3
2+-----
3+* Clarify some variable names in the examples + semantic html pedantry
servant-examples/servant-examples.cabal+1−1
@@ -1,5 +1,5 @@
1name: servant-examples
1name: servant-examples
2−version: 0.4.1
2+version: 0.4.3
3synopsis: Example programs for servant
3synopsis: Example programs for servant
4description: Example programs for servant,
4description: Example programs for servant,
5 showcasing solutions to common needs.
5 showcasing solutions to common needs.
servant-examples/tutorial/T4.hs+7−7
@@ -25,11 +25,11 @@ instance ToJSON Person
25
25
26-- HTML serialization of a single person
26-- HTML serialization of a single person
27instance ToHtml Person where
27instance ToHtml Person where
28− toHtml p =
28+ toHtml person =
29 tr_ $ do
29 tr_ $ do
30− td_ (toHtml $ firstName p)
30+ td_ (toHtml $ firstName person)
31− td_ (toHtml $ lastName p)
31+ td_ (toHtml $ lastName person)
32− td_ (toHtml . show $ age p)
32+ td_ (toHtml . show $ age person)
33
33
34 toHtmlRaw = toHtml
34 toHtmlRaw = toHtml
35
35
@@ -37,9 +37,9 @@ instance ToHtml Person where
37instance ToHtml [Person] where
37instance ToHtml [Person] where
38 toHtml persons = table_ $ do
38 toHtml persons = table_ $ do
39 tr_ $ do
39 tr_ $ do
40− td_ "first name"
40+ th_ "first name"
41− td_ "last name"
41+ th_ "last name"
42− td_ "age"
42+ th_ "age"
43
43
44 foldMap toHtml persons
44 foldMap toHtml persons
45
45
servant-jquery/CHANGELOG.md+4
@@ -1,3 +1,7 @@
1+0.4.3
2+-----
3+* Content type now set to JSON when a request body is sent (#122)
4+
10.4
50.4
2---
6---
3* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body
7* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body
servant-jquery/servant-jquery.cabal+1−1
@@ -1,5 +1,5 @@
1name: servant-jquery
1name: servant-jquery
2−version: 0.4.1
2+version: 0.4.3
3synopsis: Automatically derive (jquery) javascript functions to query servant webservices
3synopsis: Automatically derive (jquery) javascript functions to query servant webservices
4description:
4description:
5 Automatically derive jquery-based javascript functions to query servant webservices.
5 Automatically derive jquery-based javascript functions to query servant webservices.
servant-jquery/src/Servant/JQuery.hs+3−2
@@ -65,13 +65,14 @@ generateJS req = "\n" <>
65
65
66 dataBody =
66 dataBody =
67 if req ^. reqBody
67 if req ^. reqBody
68− then "\n , data: JSON.stringify(body)\n"
68+ then " , data: JSON.stringify(body)\n" <>
69+ " , contentType: 'application/json'\n"
69 else ""
70 else ""
70
71
71 reqheaders =
72 reqheaders =
72 if null hs
73 if null hs
73 then ""
74 then ""
74− else "\n , headers: { " ++ headersStr ++ " }\n"
75+ else " , headers: { " ++ headersStr ++ " }\n"
75
76
76 where headersStr = intercalate ", " $ map headerStr hs
77 where headersStr = intercalate ", " $ map headerStr hs
77 headerStr header = "\"" ++
78 headerStr header = "\"" ++
servant-lucid/servant-lucid.cabal+1−1
@@ -2,7 +2,7 @@
2-- documentation, see http://haskell.org/cabal/users-guide/
2-- documentation, see http://haskell.org/cabal/users-guide/
3
3
4name: servant-lucid
4name: servant-lucid
5−version: 0.4.1
5+version: 0.4.3
6synopsis: Servant support for lucid
6synopsis: Servant support for lucid
7-- description:
7-- description:
8homepage: http://haskell-servant.github.io/
8homepage: http://haskell-servant.github.io/
servant-server/servant-server.cabal+2−2
@@ -1,5 +1,5 @@
1name: servant-server
1name: servant-server
2−version: 0.4.1
2+version: 0.4.3
3synopsis: A family of combinators for defining webservices APIs and serving them
3synopsis: A family of combinators for defining webservices APIs and serving them
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
@@ -51,7 +51,7 @@ library
51 , safe >= 0.3 && < 0.4
51 , safe >= 0.3 && < 0.4
52 , servant == 0.4.*
52 , servant == 0.4.*
53 , split >= 0.2 && < 0.3
53 , split >= 0.2 && < 0.3
54− , string-conversions >= 0.3 && < 0.4
54+ , string-conversions >= 0.3 && < 0.5
55 , system-filepath >= 0.4 && < 0.5
55 , system-filepath >= 0.4 && < 0.5
56 , filepath >= 1
56 , filepath >= 1
57 , text >= 1.2 && < 1.3
57 , text >= 1.2 && < 1.3
servant/CHANGELOG.md+4
@@ -1,3 +1,7 @@
1+0.4.3
2+-----
3+* Add missing HasLink instance for Header (https://github.com/haskell-servant/servant/issues/128)
4+
10.4.1
50.4.1
2-----
6-----
3* Allow whitespace after parsing JSON
7* Allow whitespace after parsing JSON
servant/servant.cabal+2−2
@@ -1,5 +1,5 @@
1name: servant
1name: servant
2−version: 0.4.1
2+version: 0.4.3
3synopsis: A family of combinators for defining webservices APIs
3synopsis: A family of combinators for defining webservices APIs
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
@@ -55,7 +55,7 @@ library
55 , http-media >= 0.4 && < 0.7
55 , http-media >= 0.4 && < 0.7
56 , http-types == 0.8.*
56 , http-types == 0.8.*
57 , text >= 1 && < 2
57 , text >= 1 && < 2
58− , string-conversions >= 0.3 && < 0.4
58+ , string-conversions >= 0.3 && < 0.5
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
servant/src/Servant/API/ContentTypes.hs+1−1
@@ -166,7 +166,7 @@ instance ( AllMimeRender ctyps a, IsNonEmpty ctyps
166 handleAcceptH _ (AcceptHeader accept) val = M.mapAcceptMedia lkup accept
166 handleAcceptH _ (AcceptHeader accept) val = M.mapAcceptMedia lkup accept
167 where pctyps = Proxy :: Proxy ctyps
167 where pctyps = Proxy :: Proxy ctyps
168 amrs = allMimeRender pctyps val
168 amrs = allMimeRender pctyps val
169− lkup = fmap (\(a,b) -> (a, (cs $ show a, b))) amrs
169+ lkup = fmap (\(a,b) -> (a, (fromStrict $ M.renderHeader a, b))) amrs
170
170
171
171
172--------------------------------------------------------------------------
172--------------------------------------------------------------------------
servant/src/Servant/Utils/Links.hs+4
@@ -339,6 +339,10 @@ instance (ToText v, HasLink sub)
339 toLink (Proxy :: Proxy sub) $
339 toLink (Proxy :: Proxy sub) $
340 addSegment (escape . unpack $ toText v) l
340 addSegment (escape . unpack $ toText v) l
341
341
342+instance HasLink sub => HasLink (Header sym a :> sub) where
343+ type MkLink (Header sym a :> sub) = MkLink sub
344+ toLink _ = toLink (Proxy :: Proxy sub)
345+
342-- Verb (terminal) instances
346-- Verb (terminal) instances
343instance HasLink (Get y r) where
347instance HasLink (Get y r) where
344 type MkLink (Get y r) = URI
348 type MkLink (Get y r) = URI