diff --git a/servant-server/test/Servant/ServerSpec.hs b/servant-server/test/Servant/ServerSpec.hs index 746f72c8..8bd049e8 100644 --- a/servant-server/test/Servant/ServerSpec.hs +++ b/servant-server/test/Servant/ServerSpec.hs @@ -318,7 +318,7 @@ captureTimeSpec = do with (return (serve (Proxy :: Proxy (Capture "datetime" (FTime TimeFormatWSpace UTCTime) :> Raw)) - (\ (FTime day )request_ respond -> + (\ (FTime _day) request_ respond -> respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do it "strips the captured path snippet from pathInfo" $ do get "/2015-12-02%2012:34:56+1000/foo" `shouldRespondWith` (fromString (show ["foo" :: String])) diff --git a/servant/src/Servant/API/Times.hs b/servant/src/Servant/API/Times.hs index a5c120b0..7a79147b 100644 --- a/servant/src/Servant/API/Times.hs +++ b/servant/src/Servant/API/Times.hs @@ -1,10 +1,10 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} module Servant.API.Times @@ -18,17 +18,17 @@ module Servant.API.Times , ISO8601DateTimeZ ) where -import Data.Typeable (Typeable) -import GHC.TypeLits -- (Symbol) +import Data.Typeable (Typeable) +import GHC.TypeLits (Symbol,KnownSymbol,symbolVal) import Web.HttpApiData import qualified Data.Time.Format as T #if !MIN_VERSION_time(1,5,0) -import System.Locale as T +import qualified System.Locale as T #endif -import Data.Text (pack, Text) +import Data.Text (pack, Text) import Data.Proxy -import Control.Monad ((>=>)) -import Control.Arrow (first) +import Control.Monad ((>=>)) +import Control.Arrow (first) type ISO8601Date = "%Y-%m-%d" @@ -49,7 +49,7 @@ newtype FTime (format :: Symbol) t = FTime {getFTime :: t} deriving (Typeable, Eq, Ord) instance (KnownSymbol format, T.FormatTime t) => Show (FTime format t) where - showsPrec i t = showParen (i > 1) (\str -> renderTime t ++ str) + showsPrec i t = showParen (i > 1) (renderTime t ++) instance (KnownSymbol format, T.ParseTime t) => Read (FTime format t) where readsPrec i str = res