Merge pull request #234 from haskell-servant/jkarni/werror

Turn on Werror on travis.
This commit is contained in:
Julian Arni 2015-09-23 20:50:27 +02:00
commit c4561b4c6c
13 changed files with 40 additions and 16 deletions

View file

@ -19,7 +19,7 @@ install:
script: script:
- stack setup - stack setup
- stack build - stack build --ghc-options "-Werror"
- stack test - stack test
cache: cache:

View file

@ -65,6 +65,7 @@ executable greet-docs
test-suite spec test-suite spec
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: Spec.hs main-is: Spec.hs
other-modules: Servant.DocsSpec
hs-source-dirs: test hs-source-dirs: test
ghc-options: -Wall ghc-options: -Wall
build-depends: build-depends:

View file

@ -23,19 +23,21 @@ module Servant.Docs.Internal where
import Control.Applicative import Control.Applicative
import Control.Arrow (second) import Control.Arrow (second)
import Control.Lens hiding (List, to, from) import Control.Lens (makeLenses, over, traversed, (%~),
(&), (.~), (<>~), (^.), _1, _2,
_last, (|>))
import qualified Control.Monad.Omega as Omega import qualified Control.Monad.Omega as Omega
import Data.ByteString.Conversion (ToByteString, toByteString) import Data.ByteString.Conversion (ToByteString, toByteString)
import Data.ByteString.Lazy.Char8 (ByteString) import Data.ByteString.Lazy.Char8 (ByteString)
import qualified Data.CaseInsensitive as CI import qualified Data.CaseInsensitive as CI
import Data.Hashable import Data.Hashable (Hashable)
import Data.HashMap.Strict (HashMap) import Data.HashMap.Strict (HashMap)
import Data.List import Data.List
import Data.Maybe import Data.Maybe
import Data.Monoid import Data.Monoid
import Data.Ord (comparing) import Data.Ord (comparing)
import Data.Proxy import Data.Proxy (Proxy(Proxy))
import Data.String.Conversions import Data.String.Conversions (cs)
import Data.Text (Text, pack, unpack) import Data.Text (Text, pack, unpack)
import GHC.Exts (Constraint) import GHC.Exts (Constraint)
import GHC.Generics import GHC.Generics
@ -494,9 +496,9 @@ sampleByteStrings
-> Proxy a -> Proxy a
-> [(Text, M.MediaType, ByteString)] -> [(Text, M.MediaType, ByteString)]
sampleByteStrings ctypes@Proxy Proxy = sampleByteStrings ctypes@Proxy Proxy =
let samples = toSamples (Proxy :: Proxy a) let samples' = toSamples (Proxy :: Proxy a)
enc (t, s) = uncurry (t,,) <$> allMimeRender ctypes s enc (t, s) = uncurry (t,,) <$> allMimeRender ctypes s
in concatMap enc samples in concatMap enc samples'
-- | Generate a list of 'MediaType' values describing the content types -- | Generate a list of 'MediaType' values describing the content types
-- accepted by an API component. -- accepted by an API component.
@ -640,10 +642,10 @@ markdown api = unlines $
rqbodyStr :: [M.MediaType] -> [(M.MediaType, ByteString)]-> [String] rqbodyStr :: [M.MediaType] -> [(M.MediaType, ByteString)]-> [String]
rqbodyStr [] [] = [] rqbodyStr [] [] = []
rqbodyStr types samples = rqbodyStr types s =
["#### Request:", ""] ["#### Request:", ""]
<> formatTypes types <> formatTypes types
<> concatMap formatBody samples <> concatMap formatBody s
formatTypes [] = [] formatTypes [] = []
formatTypes ts = ["- Supported content types are:", ""] formatTypes ts = ["- Supported content types are:", ""]

View file

@ -2,6 +2,7 @@
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
import Control.Applicative import Control.Applicative
import Control.Monad import Control.Monad
import Control.Monad.IO.Class import Control.Monad.IO.Class

View file

@ -20,6 +20,7 @@ source-repository head
executable tutorial executable tutorial
main-is: tutorial.hs main-is: tutorial.hs
other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
ghc-options: -Wall -fno-warn-unused-binds -fno-warn-name-shadowing -fno-warn-orphans -fno-warn-unused-imports
build-depends: build-depends:
aeson >= 0.8 aeson >= 0.8
, base >= 4.7 && < 5 , base >= 4.7 && < 5
@ -45,8 +46,10 @@ executable tutorial
executable t8-main executable t8-main
main-is: t8-main.hs main-is: t8-main.hs
other-modules: T3, T8
hs-source-dirs: tutorial hs-source-dirs: tutorial
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -fno-warn-unused-binds -fno-warn-name-shadowing
build-depends: build-depends:
aeson aeson
, base >= 4.7 && < 5 , base >= 4.7 && < 5
@ -86,6 +89,7 @@ executable wai-middleware
executable auth-combinator executable auth-combinator
main-is: auth-combinator.hs main-is: auth-combinator.hs
ghc-options: -Wall -fno-warn-unused-binds -fno-warn-name-shadowing
build-depends: build-depends:
aeson >= 0.8 aeson >= 0.8
, base >= 4.7 && < 5 , base >= 4.7 && < 5
@ -101,6 +105,8 @@ executable auth-combinator
executable socket-io-chat executable socket-io-chat
main-is: socket-io-chat.hs main-is: socket-io-chat.hs
ghc-options: -Wall -fno-warn-unused-binds -fno-warn-name-shadowing
other-modules: Chat
build-depends: build-depends:
aeson >= 0.8 aeson >= 0.8
, base >= 4.7 && < 5 , base >= 4.7 && < 5

View file

@ -4,7 +4,6 @@
module T8 where module T8 where
import Control.Monad.Trans.Except import Control.Monad.Trans.Except
import Data.Aeson
import Servant import Servant
import Servant.Client import Servant.Client

View file

@ -13,7 +13,6 @@ import GHC.Generics
import Network.Wai import Network.Wai
import Servant import Servant
import Servant.JS import Servant.JS
import Servant.JS.JQuery
import System.Random import System.Random
import qualified Data.Text as T import qualified Data.Text as T

View file

@ -3,8 +3,10 @@
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-} #if !MIN_VERSION_base(4,8,0)
{-# LANGUAGE NullaryTypeClasses #-} {-# LANGUAGE NullaryTypeClasses #-}
#endif
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
@ -47,7 +49,8 @@ module Servant.Foreign
#if !MIN_VERSION_base(4,8,0) #if !MIN_VERSION_base(4,8,0)
import Control.Applicative import Control.Applicative
#endif #endif
import Control.Lens hiding (List) import Control.Lens (makeLenses, (%~), (&), (.~),
(<>~), _last)
import Data.Char (toLower, toUpper) import Data.Char (toLower, toUpper)
import Data.List import Data.List
import Data.Proxy import Data.Proxy

View file

@ -77,6 +77,9 @@ test-suite spec
hs-source-dirs: test hs-source-dirs: test
ghc-options: -Wall ghc-options: -Wall
main-is: Spec.hs main-is: Spec.hs
other-modules:
Servant.JSSpec
Servant.JSSpec.CustomHeaders
build-depends: base build-depends: base
, hspec >= 2.1.8 , hspec >= 2.1.8
, hspec-expectations , hspec-expectations

View file

@ -29,9 +29,9 @@ module Servant.JS.Internal
, Get , Get
, Raw , Raw
, Header , Header
) where ) where
import Control.Lens hiding (List) import Control.Lens ((^.))
import qualified Data.CharSet as Set import qualified Data.CharSet as Set
import qualified Data.CharSet.Unicode.Category as Set import qualified Data.CharSet.Unicode.Category as Set
import Data.List import Data.List

View file

@ -5,6 +5,7 @@
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- | -- |
-- Module : Servant.Mock -- Module : Servant.Mock
-- Copyright : 2015 Alp Mestanogullari -- Copyright : 2015 Alp Mestanogullari
@ -165,7 +166,7 @@ instance (Arbitrary a, AllCTRender ctypes a) => HasMock (Put ctypes a) where
mock _ = mockArbitrary mock _ = mockArbitrary
instance HasMock Raw where instance HasMock Raw where
mock _ = \req respond -> do mock _ = \_req respond -> do
bdy <- genBody bdy <- genBody
respond $ responseLBS status200 [] bdy respond $ responseLBS status200 [] bdy

View file

@ -91,6 +91,10 @@ test-suite spec
default-language: Haskell2010 default-language: Haskell2010
hs-source-dirs: test hs-source-dirs: test
main-is: Spec.hs main-is: Spec.hs
other-modules:
Servant.Server.Internal.EnterSpec
Servant.ServerSpec
Servant.Utils.StaticFilesSpec
build-depends: build-depends:
base == 4.* base == 4.*
, aeson , aeson

View file

@ -90,6 +90,11 @@ test-suite spec
default-language: Haskell2010 default-language: Haskell2010
hs-source-dirs: test hs-source-dirs: test
main-is: Spec.hs main-is: Spec.hs
other-modules:
Servant.API.ContentTypesSpec
Servant.API.ResponseHeadersSpec
Servant.Common.TextSpec
Servant.Utils.LinksSpec
build-depends: build-depends:
base == 4.* base == 4.*
, aeson , aeson