Metadata revisions for servant-0.2
Package maintainers and Hackage trustees are allowed to edit certain bits
of package metadata after a release, without uploading a new tarball.
Note that the tarball itself is never changed, just the metadata that is
stored separately. For more information about metadata revisions, please
refer to the
Hackage Metadata Revisions FAQ.
No. |
Time |
User |
SHA256 |
-r5 (servant-0.2-r5) |
2017-12-10T21:44:03Z |
phadej |
11f848b3a2f9894c319f8edc6575ecec92814c8086965f665c989cc87ab7d131
|
|
|
-r4 (servant-0.2-r4) |
2016-02-16T09:51:23Z |
phadej |
dc9e2faf45efc120ed3bafaeb859dde466c489aeb27dec822fd897a62fc7bf92
|
|
|
-r3 (servant-0.2-r3) |
2015-08-08T14:01:28Z |
HerbertValerioRiedel |
4e0d5a1b3d9acbee2afbf5cf2a352a3e1005c4f14a7bddee850dae3e290283e7
|
|
|
-r2 (servant-0.2-r2) |
2014-12-09T14:49:02Z |
AlpMestanogullari |
096533d49ca530571cf4a5ce7a6245d997f742169060829c7a94e9e863edc2d6
|
|
Changed author
from Alp Mestanogullari, Sönke Hahn, Julian K. Arni
to Alp Mestanogullari, Sönke Hahn, Julian K. Arni
|
-r1 (servant-0.2-r1) |
2014-12-09T14:47:40Z |
AlpMestanogullari |
11bd5999af8e5d556f8adc85a0af563c5068b9723382db48bb38d62ccc2862b4
|
|
Changed author
from Alp Mestanogullari, Sönke Hahn, Julian K. Arni
to Alp Mestanogullari, Sönke Hahn, Julian K. Arni Changed description
from A family of combinators for defining webservices APIs and serving them
You can learn about the basics in <http://haskell-servant.github.io/getting-started/ the getting started> guide.
Here's a runnable example, with comments, that defines a dummy API and
implements a webserver that serves this API. You can find it <https://github.com/haskell-servant/servant/blob/master/example/greet.hs here> too.
> {-# LANGUAGE DataKinds #-}
> {-# LANGUAGE PolyKinds #-}
> {-# LANGUAGE TypeFamilies #-}
> {-# LANGUAGE DeriveGeneric #-}
> {-# LANGUAGE TypeOperators #-}
> {-# LANGUAGE OverloadedStrings #-}
>
> import Data.Aeson
> import Data.Monoid
> import Data.Proxy
> import Data.Text
> import GHC.Generics
> import Network.Wai
> import Network.Wai.Handler.Warp
>
> import Servant
>
> -- * Example
>
> -- | A greet message data type
> newtype Greet = Greet { msg :: Text }
> deriving (Generic, Show)
>
> instance FromJSON Greet
> instance ToJSON Greet
>
> -- API specification
> type TestApi =
> -- GET /hello/:name?capital={true, false}
> "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
>
> -- POST /greet with a Greet as JSON in the request body,
> -- returns a Greet as JSON
> :<|> "greet" :> ReqBody Greet :> Post Greet
>
> -- DELETE /greet/:greetid
> :<|> "greet" :> Capture "greetid" Text :> Delete
>
> testApi :: Proxy TestApi
> testApi = Proxy
>
> -- Server-side handlers.
> --
> -- There's one handler per endpoint, which, just like in the type
> -- that represents the API, are glued together using :<|>.
> --
> -- Each handler runs in the 'EitherT (Int, String) IO' monad.
> server :: Server TestApi
> server = helloH :<|> postGreetH :<|> deleteGreetH
>
> where helloH name Nothing = helloH name (Just False)
> helloH name (Just False) = return . Greet $ "Hello, " <> name
> helloH name (Just True) = return . Greet . toUpper $ "Hello, " <> name
>
> postGreetH greet = return greet
>
> deleteGreetH _ = return ()
>
> -- Turn the server into a WAI app. 'serve' is provided by servant,
> -- more precisely by the Servant.Server module.
> test :: Application
> test = serve testApi server
>
> -- Run the server.
> --
> -- 'run' comes from Network.Wai.Handler.Warp
> runTestServer :: Port -> IO ()
> runTestServer port = run port test
>
> -- Put this all to work!
> main :: IO ()
> main = runTestServer 8001
to A family of combinators for defining webservices APIs and serving them
You can learn about the basics in <http://haskell-servant.github.io/getting-started/ the getting started> guide.
<https://github.com/haskell-servant/servant/blob/master/example/greet.hs Here>'s a runnable example, with comments, that defines a dummy API and
implements a webserver that serves this API.
|
-r0 (servant-0.2-r0) |
2014-12-09T14:34:02Z |
AlpMestanogullari |
d40f11019a8aff1ecd50c2cf2102ac8f2f7a4e0c555a6cfdbfdd7c3006d370fe
|
|
|