servant/servant/src/Servant/API/ReqBody.hs

33 lines
826 B
Haskell
Raw Normal View History

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE PolyKinds #-}
2015-05-02 03:21:03 +02:00
{-# OPTIONS_HADDOCK not-home #-}
module Servant.API.ReqBody (
ReqBody, ReqBody',
) where
2018-03-11 16:58:31 +01:00
import Data.Typeable
(Typeable)
import Servant.API.Modifiers
2014-11-22 18:16:55 +01:00
-- | Extract the request body as a value of type @a@.
--
-- Example:
--
-- >>> -- POST /books
-- >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
type ReqBody = ReqBody' '[Required, Strict]
2018-03-11 16:58:31 +01:00
-- |
--
-- /Note:/ 'ReqBody'' is always 'Required'.
data ReqBody' (mods :: [*]) (contentTypes :: [*]) (a :: *)
deriving (Typeable)
-- $setup
-- >>> import Servant.API
-- >>> import Data.Aeson
-- >>> import Data.Text
-- >>> data Book
-- >>> instance ToJSON Book where { toJSON = undefined }