on master help sign in
Merge pull request #890 from mgsloan/kinder-type-checking
345dc8aAlp Mestanogullari
servant/src/Servant/API/Capture.hs+2−2
@@ -12,7 +12,7 @@ import GHC.TypeLits (Symbol)
12--
12--
13-- >>> -- GET /books/:isbn
13-- >>> -- GET /books/:isbn
14-- >>> type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book
14-- >>> type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book
15−data Capture (sym :: Symbol) a
15+data Capture (sym :: Symbol) (a :: *)
16 deriving (Typeable)
16 deriving (Typeable)
17
17
18
18
@@ -23,7 +23,7 @@ data Capture (sym :: Symbol) a
23--
23--
24-- >>> -- GET /src/*
24-- >>> -- GET /src/*
25-- >>> type MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile
25-- >>> type MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile
26−data CaptureAll (sym :: Symbol) a
26+data CaptureAll (sym :: Symbol) (a :: *)
27 deriving (Typeable)
27 deriving (Typeable)
28
28
29-- $setup
29-- $setup
servant/src/Servant/API/QueryParam.hs+2−2
@@ -14,7 +14,7 @@ import GHC.TypeLits (Symbol)
14--
14--
15-- >>> -- /books?author=<author name>
15-- >>> -- /books?author=<author name>
16-- >>> type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]
16-- >>> type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]
17−data QueryParam (sym :: Symbol) a
17+data QueryParam (sym :: Symbol) (a :: *)
18 deriving Typeable
18 deriving Typeable
19
19
20-- | Lookup the values associated to the @sym@ query string parameter
20-- | Lookup the values associated to the @sym@ query string parameter
@@ -28,7 +28,7 @@ data QueryParam (sym :: Symbol) a
28--
28--
29-- >>> -- /books?authors[]=<author1>&authors[]=<author2>&...
29-- >>> -- /books?authors[]=<author1>&authors[]=<author2>&...
30-- >>> type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]
30-- >>> type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]
31−data QueryParams (sym :: Symbol) a
31+data QueryParams (sym :: Symbol) (a :: *)
32 deriving Typeable
32 deriving Typeable
33
33
34-- | Lookup a potentially value-less query string parameter
34-- | Lookup a potentially value-less query string parameter
servant/src/Servant/API/ReqBody.hs+1−1
@@ -11,7 +11,7 @@ import Data.Typeable (Typeable)
11--
11--
12-- >>> -- POST /books
12-- >>> -- POST /books
13-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
13-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
14−data ReqBody (contentTypes :: [*]) a
14+data ReqBody (contentTypes :: [*]) (a :: *)
15 deriving (Typeable)
15 deriving (Typeable)
16
16
17-- $setup
17-- $setup
servant/src/Servant/API/Stream.hs+1−1
@@ -23,7 +23,7 @@ import Control.Arrow (first)
23import Network.HTTP.Types.Method (StdMethod (..))
23import Network.HTTP.Types.Method (StdMethod (..))
24
24
25-- | A Stream endpoint for a given method emits a stream of encoded values at a given Content-Type, delimited by a framing strategy. Steam endpoints always return response code 200 on success. Type synonyms are provided for standard methods.
25-- | A Stream endpoint for a given method emits a stream of encoded values at a given Content-Type, delimited by a framing strategy. Steam endpoints always return response code 200 on success. Type synonyms are provided for standard methods.
26−data Stream (method :: k1) (framing :: *) (contentType :: *) a
26+data Stream (method :: k1) (framing :: *) (contentType :: *) (a :: *)
27 deriving (Typeable, Generic)
27 deriving (Typeable, Generic)
28
28
29type StreamGet = Stream 'GET
29type StreamGet = Stream 'GET
servant/src/Servant/API/Sub.hs+1−1
@@ -14,7 +14,7 @@ import Data.Typeable (Typeable)
14-- >>> -- GET /hello/world
14-- >>> -- GET /hello/world
15-- >>> -- returning a JSON encoded World value
15-- >>> -- returning a JSON encoded World value
16-- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
16-- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
17−data (path :: k) :> a
17+data (path :: k) :> (a :: *)
18 deriving (Typeable)
18 deriving (Typeable)
19infixr 4 :>
19infixr 4 :>
20
20
servant/src/Servant/API/Verbs.hs+1−1
@@ -23,7 +23,7 @@ import Network.HTTP.Types.Method (Method, StdMethod (..),
23-- provided, but you are free to define your own:
23-- provided, but you are free to define your own:
24--
24--
25-- >>> type Post204 contentTypes a = Verb 'POST 204 contentTypes a
25-- >>> type Post204 contentTypes a = Verb 'POST 204 contentTypes a
26−data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) a
26+data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) (a :: *)
27 deriving (Typeable, Generic)
27 deriving (Typeable, Generic)
28
28
29-- * 200 responses
29-- * 200 responses
servant/test/Servant/Utils/LinksSpec.hs+2−2
@@ -24,7 +24,7 @@ type TestApi =
24 -- All of the verbs
24 -- All of the verbs
25 :<|> "get" :> Get '[JSON] NoContent
25 :<|> "get" :> Get '[JSON] NoContent
26 :<|> "put" :> Put '[JSON] NoContent
26 :<|> "put" :> Put '[JSON] NoContent
27− :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent
27+ :<|> "post" :> ReqBody '[JSON] Bool :> Post '[JSON] NoContent
28 :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
28 :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
29 :<|> "raw" :> Raw
29 :<|> "raw" :> Raw
30 :<|> NoEndpoint
30 :<|> NoEndpoint
@@ -124,6 +124,6 @@ type WrongPath = "getTypo" :> Get '[JSON] NoContent
124type WrongReturnType = "get" :> Get '[JSON] Bool
124type WrongReturnType = "get" :> Get '[JSON] Bool
125type WrongContentType = "get" :> Get '[OctetStream] NoContent
125type WrongContentType = "get" :> Get '[OctetStream] NoContent
126type WrongMethod = "get" :> Post '[JSON] NoContent
126type WrongMethod = "get" :> Post '[JSON] NoContent
127−type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool
127+type NotALink = "hello" :> ReqBody '[JSON] Bool :> Get '[JSON] Bool
128type AllGood = "get" :> Get '[JSON] NoContent
128type AllGood = "get" :> Get '[JSON] NoContent
129type NoEndpoint = "empty" :> EmptyAPI
129type NoEndpoint = "empty" :> EmptyAPI