http-types-0.12.4: Generic HTTP types for Haskell (for both client and server code).

Safe Haskell | Safe-Inferred
Language | Haskell2010

Network.HTTP.Types.Method

Contents

- HTTP methods
  - Constants
  - Standard Methods

Description

Types and constants for HTTP methods.

The HTTP standard defines a set of standard methods, when to use them, and how to handle them. The standard set has been provided as a separate data type `StdMethod`, but since you can also use custom methods, the basic type `Method` is just a synonym for `ByteString`.

Synopsis

- type Method = ByteString
- methodGet :: Method
- methodPost :: Method
- methodHead :: Method
- methodPut :: Method
- methodDelete :: Method
- methodTrace :: Method
- methodConnect :: Method
- methodOptions :: Method
- methodPatch :: Method
- data StdMethod
  - = GET
  - | POST
  - | HEAD
  - | PUT
  - | DELETE
  - | TRACE
  - | CONNECT
  - | OPTIONS
  - | PATCH
- parseMethod :: Method -> Either ByteString StdMethod
- renderMethod :: Either ByteString StdMethod -> Method
- renderStdMethod :: StdMethod -> Method

# HTTP methods

type Method = ByteString Source #

HTTP method (flat `ByteString` type).

## Constants

methodGet :: Method Source #

HTTP GET Method

methodPost :: Method Source #

HTTP POST Method

methodHead :: Method Source #

HTTP HEAD Method

methodPut :: Method Source #

HTTP PUT Method

methodDelete :: Method Source #

HTTP DELETE Method

methodTrace :: Method Source #

HTTP TRACE Method

methodConnect :: Method Source #

HTTP CONNECT Method

methodOptions :: Method Source #

HTTP OPTIONS Method

methodPatch :: Method Source #

HTTP PATCH Method

Since: 0.8.0

## Standard Methods

One data type that holds all standard HTTP methods.

data StdMethod Source #

HTTP standard method (as defined by RFC 2616, and PATCH which is defined by RFC 5789).

Since: 0.2.0

Constructors

GET |
POST |
HEAD |
PUT |
DELETE |
TRACE |
CONNECT |
OPTIONS |
PATCH | Since: 0.8.0

#### Instances

Instances details

Data StdMethod Source # | Since: 0.12.4

Instance details

Defined in Network.HTTP.Types.Method

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> StdMethod -> c StdMethod Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c StdMethod Source #

toConstr :: StdMethod -> Constr Source #

dataTypeOf :: StdMethod -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c StdMethod) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c StdMethod) Source #

gmapT :: (forall b. Data b => b -> b) -> StdMethod -> StdMethod Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> StdMethod -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> StdMethod -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> StdMethod -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> StdMethod -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> StdMethod -> m StdMethod Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> StdMethod -> m StdMethod Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> StdMethod -> m StdMethod Source #

Bounded StdMethod Source # |
Instance details Defined in Network.HTTP.Types.Method Methods minBound :: StdMethod Source # maxBound :: StdMethod Source #
Enum StdMethod Source # |

Instance details

Defined in Network.HTTP.Types.Method

Methods

succ :: StdMethod -> StdMethod Source #

pred :: StdMethod -> StdMethod Source #

toEnum :: Int -> StdMethod Source #

fromEnum :: StdMethod -> Int Source #

enumFrom :: StdMethod -> [StdMethod] Source #

enumFromThen :: StdMethod -> StdMethod -> [StdMethod] Source #

enumFromTo :: StdMethod -> StdMethod -> [StdMethod] Source #

enumFromThenTo :: StdMethod -> StdMethod -> StdMethod -> [StdMethod] Source #

Generic StdMethod Source # |

Instance details

Defined in Network.HTTP.Types.Method

Associated Types

type Rep StdMethod | Since: http-types-0.12.4

Instance details

Defined in Network.HTTP.Types.Method

type Rep StdMethod = D1 ('MetaData "StdMethod" "Network.HTTP.Types.Method" "http-types-0.12.4-1OvlBK9BqlVDFTI6Nz1ui2" 'False) (((C1 ('MetaCons "GET" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "POST" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HEAD" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PUT" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "DELETE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TRACE" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CONNECT" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "OPTIONS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PATCH" 'PrefixI 'False) (U1 :: Type -> Type)))))

Methods

from :: StdMethod -> Rep StdMethod x Source #

to :: Rep StdMethod x -> StdMethod Source #

Ix StdMethod Source # |

Instance details

Defined in Network.HTTP.Types.Method

Methods

range :: (StdMethod, StdMethod) -> [StdMethod] Source #

index :: (StdMethod, StdMethod) -> StdMethod -> Int Source #

unsafeIndex :: (StdMethod, StdMethod) -> StdMethod -> Int Source #

inRange :: (StdMethod, StdMethod) -> StdMethod -> Bool Source #

rangeSize :: (StdMethod, StdMethod) -> Int Source #

unsafeRangeSize :: (StdMethod, StdMethod) -> Int Source #

Read StdMethod Source # |
Instance details Defined in Network.HTTP.Types.Method Methods readsPrec :: Int -> ReadS StdMethod Source # readList :: ReadS [StdMethod] Source # readPrec :: ReadPrec StdMethod Source # readListPrec :: ReadPrec [StdMethod] Source #
Show StdMethod Source # |
Instance details Defined in Network.HTTP.Types.Method Methods showsPrec :: Int -> StdMethod -> ShowS Source # show :: StdMethod -> String Source # showList :: [StdMethod] -> ShowS Source #
Eq StdMethod Source # |
Instance details Defined in Network.HTTP.Types.Method Methods (==) :: StdMethod -> StdMethod -> Bool Source # (/=) :: StdMethod -> StdMethod -> Bool Source #
Ord StdMethod Source # |

Instance details

Defined in Network.HTTP.Types.Method

Methods

compare :: StdMethod -> StdMethod -> Ordering Source #

(<) :: StdMethod -> StdMethod -> Bool Source #

(<=) :: StdMethod -> StdMethod -> Bool Source #

(>) :: StdMethod -> StdMethod -> Bool Source #

(>=) :: StdMethod -> StdMethod -> Bool Source #

max :: StdMethod -> StdMethod -> StdMethod Source #

min :: StdMethod -> StdMethod -> StdMethod Source #

type Rep StdMethod Source # | Since: 0.12.4

Instance details

Defined in Network.HTTP.Types.Method

type Rep StdMethod = D1 ('MetaData "StdMethod" "Network.HTTP.Types.Method" "http-types-0.12.4-1OvlBK9BqlVDFTI6Nz1ui2" 'False) (((C1 ('MetaCons "GET" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "POST" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HEAD" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PUT" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "DELETE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TRACE" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CONNECT" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "OPTIONS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PATCH" 'PrefixI 'False) (U1 :: Type -> Type)))))

parseMethod :: Method -> Either ByteString StdMethod Source #

Convert a method `ByteString` to a `StdMethod` if possible.

Since: 0.2.0

renderMethod :: Either ByteString StdMethod -> Method Source #

Convert an algebraic method to a `ByteString`.

    renderMethod (parseMethod bs) == bs

Since: 0.3.0

renderStdMethod :: StdMethod -> Method Source #

Convert a `StdMethod` to a `ByteString`.

Since: 0.2.0