on master help sign in
Merge pull request #5 from zerobuzz/2015-01-06-explicit-import-lists

Explicit import lists

commit5a6d864ebec276bdfb075b22fc86b1c901056876 authorAlp Mestanogullari <alpmestan@gmail.com> dateTue 6 Jan 2015, 18:32 (12 years ago) parent7ea120392a8a78
12 files changed+79−56
src/Servant/API.hs+13−13 src/Servant/API/Delete.hs+1−1 src/Servant/API/Get.hs+1−1 src/Servant/API/Header.hs−2 src/Servant/API/Post.hs+1−1 src/Servant/API/Put.hs+1−1 src/Servant/API/Sub.hs+1−2 src/Servant/Common/Text.hs+5−5 src/Servant/QQ.hs+31−14 src/Servant/Utils/Links.hs+11−12 test/Servant/QQSpec.hs+10−1 test/Servant/Utils/LinksSpec.hs+4−3
src/Servant/API.hs+13−13
@@ -37,16 +37,16 @@ module Servant.API (
3737 module Servant.Utils.Links,
3838 ) where
3939
40−import Servant.API.Alternative
41−import Servant.API.Capture
42−import Servant.API.Delete
43−import Servant.API.Get
44−import Servant.API.Header
45−import Servant.API.Post
46−import Servant.API.Put
47−import Servant.API.QueryParam
48−import Servant.API.Raw
49−import Servant.API.ReqBody
50−import Servant.API.Sub
51−import Servant.QQ (sitemap)
52−import Servant.Utils.Links (mkLink)
40+import Servant.API.Alternative ( (:<|>)(..) )
41+import Servant.API.Capture ( Capture )
42+import Servant.API.Delete ( Delete )
43+import Servant.API.Get ( Get )
44+import Servant.API.Header ( Header )
45+import Servant.API.Post ( Post )
46+import Servant.API.Put ( Put )
47+import Servant.API.QueryParam ( QueryFlag, QueryParams, QueryParam )
48+import Servant.API.Raw ( Raw )
49+import Servant.API.ReqBody ( ReqBody )
50+import Servant.API.Sub ( (:>)(..) )
51+import Servant.QQ ( sitemap )
52+import Servant.Utils.Links ( mkLink )
src/Servant/API/Delete.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22module Servant.API.Delete where
33
4−import Data.Typeable
4+import Data.Typeable ( Typeable )
55
66-- | Combinator for DELETE requests.
77--
src/Servant/API/Get.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22module Servant.API.Get where
33
4−import Data.Typeable
4+import Data.Typeable ( Typeable )
55
66-- | Endpoint for simple GET requests. Serves the result as JSON.
77--
src/Servant/API/Header.hs−2
@@ -1,8 +1,6 @@
11{-# LANGUAGE PolyKinds #-}
22module Servant.API.Header where
33
4−import GHC.TypeLits
5−
64-- | Extract the given header's value as a value of type @a@.
75--
86-- Example:
src/Servant/API/Post.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22module Servant.API.Post where
33
4−import Data.Typeable
4+import Data.Typeable ( Typeable )
55
66-- | Endpoint for POST requests. The type variable represents the type of the
77-- response body (not the request body, use 'Servant.API.ReqBody.ReqBody' for
src/Servant/API/Put.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22module Servant.API.Put where
33
4−import Data.Typeable
4+import Data.Typeable ( Typeable )
55
66-- | Endpoint for PUT requests, usually used to update a ressource.
77-- The type @a@ is the type of the response body that's returned.
src/Servant/API/Sub.hs+1−2
@@ -2,8 +2,7 @@
22{-# LANGUAGE TypeOperators #-}
33module Servant.API.Sub where
44
5−import Data.Proxy
6−import GHC.TypeLits
5+import Data.Proxy ( Proxy )
76
87-- | The contained API (second argument) can be found under @("/" ++ path)@
98-- (path being the first argument).
src/Servant/Common/Text.hs+5−5
@@ -6,11 +6,11 @@ module Servant.Common.Text
66 , ToText(..)
77 ) where
88
9−import Data.String.Conversions
10−import Data.Int
11−import Data.Text
12−import Data.Text.Read
13−import Data.Word
9+import Data.String.Conversions ( cs )
10+import Data.Int ( Int8, Int16, Int32, Int64 )
11+import Data.Text ( Text )
12+import Data.Text.Read ( rational, signed, decimal, Reader )
13+import Data.Word ( Word, Word8, Word16, Word32, Word64 )
1414
1515-- | For getting values from url captures and query string parameters
1616class FromText a where
src/Servant/QQ.hs+31−14
@@ -28,21 +28,39 @@
2828-- Note the @/@ before a @QueryParam@!
2929module Servant.QQ (sitemap) where
3030
31−import Control.Monad (void)
32−import Control.Applicative hiding (many, (<|>), optional)
33−import Language.Haskell.TH.Quote
31+import Control.Monad ( void )
32+import Control.Applicative ( (<$>) )
33+import Language.Haskell.TH.Quote ( QuasiQuoter(..) )
3434import Language.Haskell.TH
35+ ( mkName, Type(AppT, ConT, LitT), TyLit(StrTyLit) )
3536import Text.ParserCombinators.Parsec
36−
37−import Servant.API.Capture
38−import Servant.API.Get
39−import Servant.API.Post
40−import Servant.API.Put
41−import Servant.API.Delete
42−import Servant.API.QueryParam
43−import Servant.API.ReqBody
44−import Servant.API.Sub
45−import Servant.API.Alternative
37+ ( try,
38+ Parser,
39+ manyTill,
40+ endBy,
41+ sepBy1,
42+ optional,
43+ optionMaybe,
44+ string,
45+ anyChar,
46+ char,
47+ spaces,
48+ noneOf,
49+ parse,
50+ skipMany,
51+ many,
52+ lookAhead,
53+ (<|>),
54+ (<?>) )
55+import Servant.API.Capture ( Capture )
56+import Servant.API.Get ( Get )
57+import Servant.API.Post ( Post )
58+import Servant.API.Put ( Put )
59+import Servant.API.Delete ( Delete )
60+import Servant.API.QueryParam ( QueryParam )
61+import Servant.API.ReqBody ( ReqBody )
62+import Servant.API.Sub ( (:>) )
63+import Servant.API.Alternative ( (:<|>) )
4664
4765-- | Finally-tagless encoding for our DSL.
4866-- Keeping 'repr'' and 'repr' distinct when writing functions with an
@@ -195,4 +213,3 @@ sitemap = QuasiQuoter { quoteExp = undefined
195213 Right st -> return st
196214 , quoteDec = undefined
197215 }
198−
src/Servant/Utils/Links.hs+11−12
@@ -48,18 +48,18 @@ module Servant.Utils.Links (
4848 , IsLink
4949 )where
5050
51−import Data.Proxy
52−import GHC.TypeLits
51+import Data.Proxy ( Proxy(..) )
52+import GHC.TypeLits ( KnownSymbol, Symbol, symbolVal )
5353
54−import Servant.API.Capture
55−import Servant.API.ReqBody
56−import Servant.API.QueryParam
57−import Servant.API.Get
58−import Servant.API.Post
59−import Servant.API.Put
60−import Servant.API.Delete
61−import Servant.API.Sub
62−import Servant.API.Alternative
54+import Servant.API.Capture ( Capture )
55+import Servant.API.ReqBody ( ReqBody )
56+import Servant.API.QueryParam ( QueryParam )
57+import Servant.API.Get ( Get )
58+import Servant.API.Post ( Post )
59+import Servant.API.Put ( Put )
60+import Servant.API.Delete ( Delete )
61+import Servant.API.Sub ( type (:>) )
62+import Servant.API.Alternative ( type (:<|>) )
6363
6464
6565type family Or a b where
@@ -123,4 +123,3 @@ instance VLinkHelper (Get x) where
123123
124124instance VLinkHelper (Post x) where
125125 vlh _ = ""
126−
test/Servant/QQSpec.hs+10−1
@@ -9,9 +9,18 @@
99{-# LANGUAGE UndecidableInstances #-}
1010module Servant.QQSpec where
1111
12−import Test.Hspec
12+import Test.Hspec ( Expectation, Spec, shouldBe, it, describe )
1313
1414import Servant.API
15+ ( (:<|>),
16+ ReqBody,
17+ QueryParam,
18+ Put,
19+ Get,
20+ Post,
21+ Capture,
22+ (:>),
23+ sitemap )
1524
1625--------------------------------------------------------------------------
1726-- Types for testing
test/Servant/Utils/LinksSpec.hs+4−3
@@ -3,11 +3,13 @@
33{-# LANGUAGE TypeOperators #-}
44module Servant.Utils.LinksSpec where
55
6−import Test.Hspec
6+import Test.Hspec ( Spec, it, describe )
77
88import Servant.API
9+ ( type (:<|>), ReqBody, QueryParam, Get, Post, Capture, type (:>) )
910import Servant.QQSpec ( (~>) )
10−import Servant.Utils.Links (IsElem, IsLink)
11+import Servant.Utils.Links ( IsElem, IsLink )
12+
1113
1214type TestApi =
1315 "hello" :> Capture "name" String :> QueryParam "capital" Bool :> Get Bool
@@ -49,4 +51,3 @@ isLink = describe "IsLink" $ do
4951 it "is False of anything with captures" $ do
5052 reflected (Proxy::Proxy (IsLink NotALink)) ~> False
5153 reflected (Proxy::Proxy (IsLink NotALink2)) ~> False
52−