Merge pull request #235 from haskell-servant/jkarni/0.4-fixes
Werror fixes
This commit is contained in:
commit
4e28a45da4
16 changed files with 38 additions and 28 deletions
|
@ -17,7 +17,8 @@ set -o errexit
|
||||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
. "$DIR"/lib/common.sh
|
. "$DIR"/lib/common.sh
|
||||||
|
|
||||||
GHC_FLAGS="-Werror"
|
# TODO: Remove missing-methods after https://github.com/bos/aeson/issues/290
|
||||||
|
GHC_FLAGS="-Werror -fno-warn-missing-methods"
|
||||||
|
|
||||||
prepare_sandbox () {
|
prepare_sandbox () {
|
||||||
$CABAL sandbox init
|
$CABAL sandbox init
|
||||||
|
|
|
@ -22,18 +22,20 @@ module Servant.Docs.Internal where
|
||||||
#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
|
import Control.Lens (makeLenses, over, traversed, (%~),
|
||||||
|
(&), (.~), (<>~), (^.), _1, _2,
|
||||||
|
_last, (|>))
|
||||||
|
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.ByteString.Conversion (ToByteString, toByteString)
|
import Data.String.Conversions (cs)
|
||||||
import Data.String.Conversions
|
|
||||||
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
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
|
||||||
|
{-# 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
|
||||||
|
|
|
@ -45,6 +45,7 @@ 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
|
||||||
build-depends:
|
build-depends:
|
||||||
|
|
|
@ -17,11 +17,6 @@ data User = User
|
||||||
, registration_date :: Day
|
, registration_date :: Day
|
||||||
} deriving (Eq, Show, Generic)
|
} deriving (Eq, Show, Generic)
|
||||||
|
|
||||||
-- orphan ToJSON instance for Day. necessary to derive one for User
|
|
||||||
instance ToJSON Day where
|
|
||||||
-- display a day in YYYY-mm-dd format
|
|
||||||
toJSON d = toJSON (showGregorian d)
|
|
||||||
|
|
||||||
instance ToJSON User
|
instance ToJSON User
|
||||||
|
|
||||||
type UserAPI = "users" :> Get '[JSON] [User]
|
type UserAPI = "users" :> Get '[JSON] [User]
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
module T10 where
|
module T10 where
|
||||||
|
|
||||||
import Data.ByteString.Lazy (ByteString)
|
import Data.ByteString.Lazy (ByteString)
|
||||||
|
|
|
@ -70,7 +70,7 @@ server = position
|
||||||
:<|> marketing
|
:<|> marketing
|
||||||
|
|
||||||
where position :: Int -> Int -> EitherT ServantErr IO Position
|
where position :: Int -> Int -> EitherT ServantErr IO Position
|
||||||
position x y = return (Position x y)
|
position a b = return (Position a b)
|
||||||
|
|
||||||
hello :: Maybe String -> EitherT ServantErr IO HelloMessage
|
hello :: Maybe String -> EitherT ServantErr IO HelloMessage
|
||||||
hello mname = return . HelloMessage $ case mname of
|
hello mname = return . HelloMessage $ case mname of
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
|
||||||
module T4 where
|
module T4 where
|
||||||
|
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
|
@ -35,13 +36,13 @@ instance ToHtml Person where
|
||||||
|
|
||||||
-- HTML serialization of a list of persons
|
-- HTML serialization of a list of persons
|
||||||
instance ToHtml [Person] where
|
instance ToHtml [Person] where
|
||||||
toHtml persons = table_ $ do
|
toHtml ps = table_ $ do
|
||||||
tr_ $ do
|
tr_ $ do
|
||||||
th_ "first name"
|
th_ "first name"
|
||||||
th_ "last name"
|
th_ "last name"
|
||||||
th_ "age"
|
th_ "age"
|
||||||
|
|
||||||
foldMap toHtml persons
|
foldMap toHtml ps
|
||||||
|
|
||||||
toHtmlRaw = toHtml
|
toHtmlRaw = toHtml
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
|
||||||
module T8 where
|
module T8 where
|
||||||
|
|
||||||
import Control.Monad.Trans.Either
|
import Control.Monad.Trans.Either
|
||||||
import Data.Aeson
|
|
||||||
import Servant
|
import Servant
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
|
||||||
module T9 where
|
module T9 where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Text
|
import Data.Text
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
|
|
|
@ -13,7 +13,8 @@ module Servant.JQuery.Internal where
|
||||||
#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
|
import Control.Lens (makeLenses, (%~), (&), (.~)
|
||||||
|
, (<>~), (^.), _last)
|
||||||
import Data.Char (toLower)
|
import Data.Char (toLower)
|
||||||
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
|
||||||
|
|
|
@ -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
|
||||||
|
@ -153,7 +154,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 _ = \_ respond -> do
|
||||||
bdy <- genBody
|
bdy <- genBody
|
||||||
respond $ responseLBS status200 [] bdy
|
respond $ responseLBS status200 [] bdy
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Servant.API.ContentTypesSpec where
|
module Servant.API.ContentTypesSpec where
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
|
|
|
@ -11,4 +11,5 @@ packages:
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- engine-io-wai-1.0.2
|
- engine-io-wai-1.0.2
|
||||||
- attoparsec-0.13.0.1
|
- attoparsec-0.13.0.1
|
||||||
|
- aeson-0.10.0.0
|
||||||
resolver: nightly-2015-07-24
|
resolver: nightly-2015-07-24
|
||||||
|
|
Loading…
Reference in a new issue