git.iko.soy/typeable/servant
on master help sign in
Merge pull request #890 from mgsloan/kinder-type-checking

Kinder type checking

commit345dc8a1bddc1ec95adb19475754c9261bbe86c0 authorAlp Mestanogullari <alpmestan@gmail.com> dateThu 18 Jan 2018, 08:25 (9 years ago) parenta6cd6fc7e0ad51
7 files changed+10−10
servant/src/Servant/API/Capture.hs+2−2 servant/src/Servant/API/QueryParam.hs+2−2 servant/src/Servant/API/ReqBody.hs+1−1 servant/src/Servant/API/Stream.hs+1−1 servant/src/Servant/API/Sub.hs+1−1 servant/src/Servant/API/Verbs.hs+1−1 servant/test/Servant/Utils/LinksSpec.hs+2−2
servant/src/Servant/API/Capture.hs+2−2
@@ -12,7 +12,7 @@ import GHC.TypeLits (Symbol)
1212--
1313-- >>> -- GET /books/:isbn
1414-- >>> type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book
15−data Capture (sym :: Symbol) a
15+data Capture (sym :: Symbol) (a :: *)
1616 deriving (Typeable)
1717
1818
@@ -23,7 +23,7 @@ data Capture (sym :: Symbol) a
2323--
2424-- >>> -- GET /src/*
2525-- >>> type MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile
26−data CaptureAll (sym :: Symbol) a
26+data CaptureAll (sym :: Symbol) (a :: *)
2727 deriving (Typeable)
2828
2929-- $setup
servant/src/Servant/API/QueryParam.hs+2−2
@@ -14,7 +14,7 @@ import GHC.TypeLits (Symbol)
1414--
1515-- >>> -- /books?author=<author name>
1616-- >>> type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]
17−data QueryParam (sym :: Symbol) a
17+data QueryParam (sym :: Symbol) (a :: *)
1818 deriving Typeable
1919
2020-- | Lookup the values associated to the @sym@ query string parameter
@@ -28,7 +28,7 @@ data QueryParam (sym :: Symbol) a
2828--
2929-- >>> -- /books?authors[]=<author1>&authors[]=<author2>&...
3030-- >>> type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]
31−data QueryParams (sym :: Symbol) a
31+data QueryParams (sym :: Symbol) (a :: *)
3232 deriving Typeable
3333
3434-- | Lookup a potentially value-less query string parameter
servant/src/Servant/API/ReqBody.hs+1−1
@@ -11,7 +11,7 @@ import Data.Typeable (Typeable)
1111--
1212-- >>> -- POST /books
1313-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
14−data ReqBody (contentTypes :: [*]) a
14+data ReqBody (contentTypes :: [*]) (a :: *)
1515 deriving (Typeable)
1616
1717-- $setup
servant/src/Servant/API/Stream.hs+1−1
@@ -23,7 +23,7 @@ import Control.Arrow (first)
2323import Network.HTTP.Types.Method (StdMethod (..))
2424
2525-- | 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 :: *)
2727 deriving (Typeable, Generic)
2828
2929type StreamGet = Stream 'GET
servant/src/Servant/API/Sub.hs+1−1
@@ -14,7 +14,7 @@ import Data.Typeable (Typeable)
1414-- >>> -- GET /hello/world
1515-- >>> -- returning a JSON encoded World value
1616-- >>> type MyApi = "hello" :> "world" :> Get '[JSON] World
17−data (path :: k) :> a
17+data (path :: k) :> (a :: *)
1818 deriving (Typeable)
1919infixr 4 :>
2020
servant/src/Servant/API/Verbs.hs+1−1
@@ -23,7 +23,7 @@ import Network.HTTP.Types.Method (Method, StdMethod (..),
2323-- provided, but you are free to define your own:
2424--
2525-- >>> 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 :: *)
2727 deriving (Typeable, Generic)
2828
2929-- * 200 responses
servant/test/Servant/Utils/LinksSpec.hs+2−2
@@ -24,7 +24,7 @@ type TestApi =
2424 -- All of the verbs
2525 :<|> "get" :> Get '[JSON] NoContent
2626 :<|> "put" :> Put '[JSON] NoContent
27− :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent
27+ :<|> "post" :> ReqBody '[JSON] Bool :> Post '[JSON] NoContent
2828 :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
2929 :<|> "raw" :> Raw
3030 :<|> NoEndpoint
@@ -124,6 +124,6 @@ type WrongPath = "getTypo" :> Get '[JSON] NoContent
124124type WrongReturnType = "get" :> Get '[JSON] Bool
125125type WrongContentType = "get" :> Get '[OctetStream] NoContent
126126type 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
128128type AllGood = "get" :> Get '[JSON] NoContent
129129type NoEndpoint = "empty" :> EmptyAPI