mig-extra-0.1.1.0: Extra utils for Mig core library
Safe HaskellSafe-Inferred
LanguageGHC2021

Mig.Extra.Server.Common

Description

Module for common re-exports

Synopsis

types

newtype Server (m :: Type -> Type) #

Server type. It is a function fron request to response. Some servers does not return valid value. We use it to find right path.

Example:

server :: Server IO
server =
  "api/v1" /.
     [ "foo" /. handleFoo
     , "bar" /. handleBar
     ]

handleFoo :: Query "name" Int -> Get IO (Resp Json Text)
handleBar :: Post Json IO Text

Note that server is monoid and it can be constructed with Monoid functions and path constructor (/.). To pass inputs for handler we can use special newtype wrappers:

  • Query - for required query parameters
  • Optional - for optional query parameters
  • QueryFlag - for boolean query flags
  • Capture - for parsing elements of URI
  • Header - for parsing headers
  • OptionalHeader - for parsing optional headers
  • Body - fot request-body input

and other request types.

To distinguish by HTTP-method we use corresponding constructors: Get, Post, Put, etc. Let's discuss the structure of the constructor. Let's take Get for example:

type Get m a = Send GET m a
newtype Send method m a = Send (m a)

Let's look at the arguments of he type

  • method - type tag of the HTTP-method (GET, POST, PUT, DELETE, etc.)
  • m - underlying server monad
  • a - response type. It should be convertible to the type of the response (see IsResp class).

Constructors

Server 

Fields

Instances

Instances details
Monoid (Server m) 
Instance details

Defined in Mig.Core.Server

Methods

mempty :: Server m #

mappend :: Server m -> Server m -> Server m #

mconcat :: [Server m] -> Server m #

Semigroup (Server m) 
Instance details

Defined in Mig.Core.Server

Methods

(<>) :: Server m -> Server m -> Server m #

sconcat :: NonEmpty (Server m) -> Server m #

stimes :: Integral b => b -> Server m -> Server m #

ToServer (Server m) 
Instance details

Defined in Mig.Core.Class.Server

Methods

toServer :: Server m -> Server (MonadOf (Server m)) #

data Api a #

HTTP API container

Constructors

Append (Api a) (Api a)

alternative between two API's

Empty

an empty API that does nothing

WithPath Path (Api a)

path prefix for an API

HandleRoute a

handle route

Instances

Instances details
Foldable Api 
Instance details

Defined in Mig.Core.Api

Methods

fold :: Monoid m => Api m -> m #

foldMap :: Monoid m => (a -> m) -> Api a -> m #

foldMap' :: Monoid m => (a -> m) -> Api a -> m #

foldr :: (a -> b -> b) -> b -> Api a -> b #

foldr' :: (a -> b -> b) -> b -> Api a -> b #

foldl :: (b -> a -> b) -> b -> Api a -> b #

foldl' :: (b -> a -> b) -> b -> Api a -> b #

foldr1 :: (a -> a -> a) -> Api a -> a #

foldl1 :: (a -> a -> a) -> Api a -> a #

toList :: Api a -> [a] #

null :: Api a -> Bool #

length :: Api a -> Int #

elem :: Eq a => a -> Api a -> Bool #

maximum :: Ord a => Api a -> a #

minimum :: Ord a => Api a -> a #

sum :: Num a => Api a -> a #

product :: Num a => Api a -> a #

Traversable Api 
Instance details

Defined in Mig.Core.Api

Methods

traverse :: Applicative f => (a -> f b) -> Api a -> f (Api b) #

sequenceA :: Applicative f => Api (f a) -> f (Api a) #

mapM :: Monad m => (a -> m b) -> Api a -> m (Api b) #

sequence :: Monad m => Api (m a) -> m (Api a) #

Functor Api 
Instance details

Defined in Mig.Core.Api

Methods

fmap :: (a -> b) -> Api a -> Api b #

(<$) :: a -> Api b -> Api a #

Monoid (Api a) 
Instance details

Defined in Mig.Core.Api

Methods

mempty :: Api a #

mappend :: Api a -> Api a -> Api a #

mconcat :: [Api a] -> Api a #

Semigroup (Api a) 
Instance details

Defined in Mig.Core.Api

Methods

(<>) :: Api a -> Api a -> Api a #

sconcat :: NonEmpty (Api a) -> Api a #

stimes :: Integral b => b -> Api a -> Api a #

Show a => Show (Api a) 
Instance details

Defined in Mig.Core.Api

Methods

showsPrec :: Int -> Api a -> ShowS #

show :: Api a -> String #

showList :: [Api a] -> ShowS #

Eq a => Eq (Api a) 
Instance details

Defined in Mig.Core.Api

Methods

(==) :: Api a -> Api a -> Bool #

(/=) :: Api a -> Api a -> Bool #

newtype Path #

Path is a chain of elements which can be static types or capture. There is IsString instance which allows us to create paths from strings. Examples:

"api/v1/foo" ==> Path [StaticPath "api", StaticPath "v1", StaticPath "foo"]
"api/v1/*" ==> Path [StaticPath "api", StaticPath "v1", CapturePath "*"]

Constructors

Path 

Fields

Instances

Instances details
IsString Path 
Instance details

Defined in Mig.Core.Api

Methods

fromString :: String -> Path #

Monoid Path 
Instance details

Defined in Mig.Core.Api

Methods

mempty :: Path #

mappend :: Path -> Path -> Path #

mconcat :: [Path] -> Path #

Semigroup Path 
Instance details

Defined in Mig.Core.Api

Methods

(<>) :: Path -> Path -> Path #

sconcat :: NonEmpty Path -> Path #

stimes :: Integral b => b -> Path -> Path #

Show Path 
Instance details

Defined in Mig.Core.Api

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

Eq Path 
Instance details

Defined in Mig.Core.Api

Methods

(==) :: Path -> Path -> Bool #

(/=) :: Path -> Path -> Bool #

Ord Path 
Instance details

Defined in Mig.Core.Api

Methods

compare :: Path -> Path -> Ordering #

(<) :: Path -> Path -> Bool #

(<=) :: Path -> Path -> Bool #

(>) :: Path -> Path -> Bool #

(>=) :: Path -> Path -> Bool #

max :: Path -> Path -> Path #

min :: Path -> Path -> Path #

ToHttpApiData Path 
Instance details

Defined in Mig.Core.Api

data PathItem #

Path can be a static item or capture with a name

Instances

Instances details
Show PathItem 
Instance details

Defined in Mig.Core.Api

Eq PathItem 
Instance details

Defined in Mig.Core.Api

Ord PathItem 
Instance details

Defined in Mig.Core.Api

ToHttpApiData PathItem 
Instance details

Defined in Mig.Core.Api

data Route (m :: Type -> Type) #

Route contains API-info and how to run it

Constructors

Route 

Fields

Instances

Instances details
MonadIO m => ToRoute (Route m) 
Instance details

Defined in Mig.Core.Class.Route

DSL

data Json #

Type-level tag for JSON media type It is converted to "application/json"

Instances

Instances details
ToMediaType Json 
Instance details

Defined in Mig.Core.Class.MediaType

FromJSON a => FromReqBody Json a 
Instance details

Defined in Mig.Core.Class.MediaType

ToJSON a => ToRespBody Json a 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString #

data AnyMedia #

Signifies any media. It prescribes the server renderer to lookup media-type at run-time in the "Conten-Type" header. As media-type it is rendered to "*/*".

It is useful for values for which we want to derive content type from run-time values. For example it is used for static file servers to get media type from file extension.

Instances

Instances details
ToMediaType AnyMedia 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody AnyMedia ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody AnyMedia ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

data OctetStream #

Media type octet stream is for passing raw byte-strings in the request body. It is converted to "application/octet-stream"

data FormUrlEncoded #

Type-level tag for FORM url encoded media-type. It is converted to "application/x-www-form-urlencoded"

Instances

Instances details
ToMediaType FormUrlEncoded 
Instance details

Defined in Mig.Core.Class.MediaType

FromForm a => FromReqBody FormUrlEncoded a 
Instance details

Defined in Mig.Core.Class.MediaType

ToForm a => ToRespBody FormUrlEncoded a 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString #

class ToServer a where #

Values that can be converted to server

Methods

toServer :: a -> Server (MonadOf a) #

Convert value to server

Instances

Instances details
ToRoute a => ToServer a 
Instance details

Defined in Mig.Core.Class.Server

Methods

toServer :: a -> Server (MonadOf a) #

ToServer (Server m) 
Instance details

Defined in Mig.Core.Class.Server

Methods

toServer :: Server m -> Server (MonadOf (Server m)) #

ToServer a => ToServer [a] 
Instance details

Defined in Mig.Core.Class.Server

Methods

toServer :: [a] -> Server (MonadOf [a]) #

class MonadIO (MonadOf a) => ToRoute a where #

Values that represent routes. A route is a function of arbitrary number of arguments. Where each argument is one of the special newtype-wrappers that read type-safe information from HTTP-request and return type of the route function is a value of something convertible to HTTP-request.

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

Update API info

toRouteFun :: a -> ServerFun (MonadOf a) #

Convert to route

Instances

Instances details
MonadIO m => ToRoute (Route m) 
Instance details

Defined in Mig.Core.Class.Route

(ToSchema a, FromReqBody media a, ToRoute b) => ToRoute (Body media a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Body media a -> b) -> ServerFun (MonadOf (Body media a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Capture sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Capture sym a -> b) -> ServerFun (MonadOf (Capture sym a -> b)) #

(FromForm a, ToRoute b) => ToRoute (Cookie a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Cookie a -> b) -> ServerFun (MonadOf (Cookie a -> b)) #

ToRoute b => ToRoute (FullPathInfo -> b) 
Instance details

Defined in Mig.Core.Class.Route

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Header sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Header sym a -> b) -> ServerFun (MonadOf (Header sym a -> b)) #

ToRoute b => ToRoute (IsSecure -> b) 
Instance details

Defined in Mig.Core.Class.Route

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Optional sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Optional sym a -> b) -> ServerFun (MonadOf (Optional sym a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

ToRoute b => ToRoute (PathInfo -> b) 
Instance details

Defined in Mig.Core.Class.Route

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Query sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Query sym a -> b) -> ServerFun (MonadOf (Query sym a -> b)) #

(ToRoute b, KnownSymbol sym) => ToRoute (QueryFlag sym -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (QueryFlag sym -> b) -> ServerFun (MonadOf (QueryFlag sym -> b)) #

ToRoute b => ToRoute (RawRequest -> b) 
Instance details

Defined in Mig.Core.Class.Route

(ToSchema a, FromJSON a, ToRoute b) => ToRoute (Body a -> b) Source # 
Instance details

Defined in Mig.Extra.Server.Json

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Body a -> b) -> ServerFun (MonadOf (Body a -> b)) #

(MonadIO m, IsResp a, IsMethod method) => ToRoute (Send method m a) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: Send method m a -> ServerFun (MonadOf (Send method m a)) #

data MediaType #

An HTTP media type, consisting of the type, subtype, and parameters.

Instances

Instances details
IsString MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Show MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Eq MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Ord MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Accept MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

RenderHeader MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

HasContentType Encoding (Maybe MediaType) 
Instance details

Defined in Data.OpenApi.Lens

HasContent RequestBody (InsOrdHashMap MediaType MediaTypeObject) 
Instance details

Defined in Data.OpenApi.Lens

HasContent Response (InsOrdHashMap MediaType MediaTypeObject) 
Instance details

Defined in Data.OpenApi.Lens

class ToMediaType (a :: k) where #

Conversion of type-level tags to media type values

Instances

Instances details
ToMediaType Html 
Instance details

Defined in Mig.Core.Class.MediaType

ToMediaType ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

ToMediaType AnyMedia 
Instance details

Defined in Mig.Core.Class.MediaType

ToMediaType FormUrlEncoded 
Instance details

Defined in Mig.Core.Class.MediaType

ToMediaType Json 
Instance details

Defined in Mig.Core.Class.MediaType

ToMediaType OctetStream 
Instance details

Defined in Mig.Core.Class.MediaType

ToMediaType Text 
Instance details

Defined in Mig.Core.Class.MediaType

class ToMediaType ty => ToRespBody (ty :: k) b where #

Values that can be rendered to response body byte string.

Methods

toRespBody :: b -> ByteString #

Instances

Instances details
ToMarkup a => ToRespBody Html a 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString #

ToRespBody AnyMedia ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody AnyMedia ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

ToForm a => ToRespBody FormUrlEncoded a 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString #

ToJSON a => ToRespBody Json a 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString #

ToRespBody OctetStream ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody OctetStream ByteString 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody Text Text 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody Text Text 
Instance details

Defined in Mig.Core.Class.MediaType

response

class IsResp a where #

Values that can be converted to low-level response.

The repsonse value is usually one of two cases:

  • Resp a -- for routes which always produce a value
  • RespOr err a - for routes that can also produce an error or value.
  • Response - low-level HTTP-response.

Associated Types

type RespBody a #

the type of response body value

type RespError a #

the type of an error

type RespMedia a #

the media tpye of resp

Methods

ok :: RespBody a -> a #

Returns valid repsonse with 200 status

bad :: Status -> RespError a -> a #

Returns an error with given status

noContent :: Status -> a #

response with no content

addHeaders :: ResponseHeaders -> a -> a #

Add some header to the response

getHeaders :: a -> ResponseHeaders #

Get response headers

setStatus :: Status -> a -> a #

Sets repsonse status

getRespBody :: a -> Maybe (RespBody a) #

Get response body

getRespError :: a -> Maybe (RespError a) #

Get response error

getStatus :: a -> Status #

Get response status

setMedia :: MediaType -> a -> a #

Set the media type of the response

getMedia :: MediaType #

Reads the media type by response type

toResponse :: a -> Response #

Converts value to low-level response

Instances

Instances details
IsResp Response 
Instance details

Defined in Mig.Core.Class.Response

Associated Types

type RespBody Response #

type RespError Response #

type RespMedia Response #

ToMarkup a => IsResp (Resp a) Source # 
Instance details

Defined in Mig.Extra.Server.Html

Associated Types

type RespBody (Resp a) #

type RespError (Resp a) #

type RespMedia (Resp a) #

ToJSON a => IsResp (Resp a) Source # 
Instance details

Defined in Mig.Extra.Server.Json

Associated Types

type RespBody (Resp a) #

type RespError (Resp a) #

type RespMedia (Resp a) #

ToRespBody ty a => IsResp (Resp ty a) 
Instance details

Defined in Mig.Core.Class.Response

Associated Types

type RespBody (Resp ty a) #

type RespError (Resp ty a) #

type RespMedia (Resp ty a) #

Methods

ok :: RespBody (Resp ty a) -> Resp ty a #

bad :: Status -> RespError (Resp ty a) -> Resp ty a #

noContent :: Status -> Resp ty a #

addHeaders :: ResponseHeaders -> Resp ty a -> Resp ty a #

getHeaders :: Resp ty a -> ResponseHeaders #

setStatus :: Status -> Resp ty a -> Resp ty a #

getRespBody :: Resp ty a -> Maybe (RespBody (Resp ty a)) #

getRespError :: Resp ty a -> Maybe (RespError (Resp ty a)) #

getStatus :: Resp ty a -> Status #

setMedia :: MediaType -> Resp ty a -> Resp ty a #

getMedia :: MediaType #

toResponse :: Resp ty a -> Response #

(ToJSON err, ToJSON a) => IsResp (RespOr err a) Source # 
Instance details

Defined in Mig.Extra.Server.Json

Associated Types

type RespBody (RespOr err a) #

type RespError (RespOr err a) #

type RespMedia (RespOr err a) #

Methods

ok :: RespBody (RespOr err a) -> RespOr err a #

bad :: Status -> RespError (RespOr err a) -> RespOr err a #

noContent :: Status -> RespOr err a #

addHeaders :: ResponseHeaders -> RespOr err a -> RespOr err a #

getHeaders :: RespOr err a -> ResponseHeaders #

setStatus :: Status -> RespOr err a -> RespOr err a #

getRespBody :: RespOr err a -> Maybe (RespBody (RespOr err a)) #

getRespError :: RespOr err a -> Maybe (RespError (RespOr err a)) #

getStatus :: RespOr err a -> Status #

setMedia :: MediaType -> RespOr err a -> RespOr err a #

getMedia :: MediaType #

toResponse :: RespOr err a -> Response #

(ToRespBody ty err, ToRespBody ty a) => IsResp (RespOr ty err a) 
Instance details

Defined in Mig.Core.Class.Response

Associated Types

type RespBody (RespOr ty err a) #

type RespError (RespOr ty err a) #

type RespMedia (RespOr ty err a) #

Methods

ok :: RespBody (RespOr ty err a) -> RespOr ty err a #

bad :: Status -> RespError (RespOr ty err a) -> RespOr ty err a #

noContent :: Status -> RespOr ty err a #

addHeaders :: ResponseHeaders -> RespOr ty err a -> RespOr ty err a #

getHeaders :: RespOr ty err a -> ResponseHeaders #

setStatus :: Status -> RespOr ty err a -> RespOr ty err a #

getRespBody :: RespOr ty err a -> Maybe (RespBody (RespOr ty err a)) #

getRespError :: RespOr ty err a -> Maybe (RespError (RespOr ty err a)) #

getStatus :: RespOr ty err a -> Status #

setMedia :: MediaType -> RespOr ty err a -> RespOr ty err a #

getMedia :: MediaType #

toResponse :: RespOr ty err a -> Response #

badReq :: IsResp a => RespError a -> a #

Bad request. The bad response with 400 status.

internalServerError :: IsResp a => RespError a -> a #

Internal server error. The bad response with 500 status.

notImplemented :: IsResp a => RespError a -> a #

Not implemented route. The bad response with 501 status.

redirect :: IsResp a => Text -> a #

Redirect to url. It is bad response with 302 status and set header of Location to a given URL.

setHeader :: (IsResp a, ToHttpApiData h) => HeaderName -> h -> a -> a #

Set header for response

setCookie :: (ToForm cookie, IsResp resp) => SetCookie cookie -> resp -> resp #

Set cookie as http header from form url encoded value

data SetCookie a #

Constructors

SetCookie 

Instances

Instances details
Show a => Show (SetCookie a) 
Instance details

Defined in Mig.Core.Class.Response

Eq a => Eq (SetCookie a) 
Instance details

Defined in Mig.Core.Class.Response

Methods

(==) :: SetCookie a -> SetCookie a -> Bool #

(/=) :: SetCookie a -> SetCookie a -> Bool #

defCookie :: a -> SetCookie a #

Default cookie which sets only the cookie itself.

methods

newtype Send (method :: k) (m :: k1 -> Type) (a :: k1) #

Route response type. It encodes the route method in the type and which monad is used and which type the response has.

The repsonse value is usually one of two cases:

  • Resp media a -- for routes which always produce a value
  • RespOr media err a - for routes that can also produce an error or value.

See the class IsResp for more details on response types.

Constructors

Send 

Fields

Instances

Instances details
MonadTrans (Send method :: (Type -> Type) -> Type -> Type) 
Instance details

Defined in Mig.Core.Types.Route

Methods

lift :: Monad m => m a -> Send method m a #

MonadIO m => MonadIO (Send method m) 
Instance details

Defined in Mig.Core.Types.Route

Methods

liftIO :: IO a -> Send method m a #

Applicative m => Applicative (Send method m) 
Instance details

Defined in Mig.Core.Types.Route

Methods

pure :: a -> Send method m a #

(<*>) :: Send method m (a -> b) -> Send method m a -> Send method m b #

liftA2 :: (a -> b -> c) -> Send method m a -> Send method m b -> Send method m c #

(*>) :: Send method m a -> Send method m b -> Send method m b #

(<*) :: Send method m a -> Send method m b -> Send method m a #

Functor m => Functor (Send method m) 
Instance details

Defined in Mig.Core.Types.Route

Methods

fmap :: (a -> b) -> Send method m a -> Send method m b #

(<$) :: a -> Send method m b -> Send method m a #

Monad m => Monad (Send method m) 
Instance details

Defined in Mig.Core.Types.Route

Methods

(>>=) :: Send method m a -> (a -> Send method m b) -> Send method m b #

(>>) :: Send method m a -> Send method m b -> Send method m b #

return :: a -> Send method m a #

(MonadIO m, IsResp a, IsMethod method) => ToRoute (Send method m a) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: Send method m a -> ServerFun (MonadOf (Send method m a)) #

(ToRespBody (RespMedia a) (RespError a), IsResp a) => FromClient (Send method Client a) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (Send method Client a) #

Methods

fromClient :: Send method Client a -> ClientResult (Send method Client a) #

MapRequest (Send method Client a) 
Instance details

Defined in Mig.Client

Methods

mapRequest :: (Request -> Request) -> Send method Client a -> Send method Client a

mapCapture :: (CaptureMap -> CaptureMap) -> Send method Client a -> Send method Client a

(IsMethod method, FromReqBody (RespMedia a) (RespBody a), IsResp a) => ToClient (Send method Client a) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> Send method Client a #

clientArity :: Int #

type ClientResult (Send method Client a) 
Instance details

Defined in Mig.Client

class IsMethod (a :: k) where #

Converts type-level tag for methods to value

Methods

toMethod :: Method #

Instances

Instances details
IsMethod DELETE 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod GET 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod HEAD 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod OPTIONS 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod PATCH 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod POST 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod PUT 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

IsMethod TRACE 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data GET #

type-level GET-method tag

Instances

Instances details
IsMethod GET 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data POST #

type-level POST-method tag

Instances

Instances details
IsMethod POST 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data PUT #

type-level PUT-method tag

Instances

Instances details
IsMethod PUT 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data DELETE #

type-level DELETE-method tag

Instances

Instances details
IsMethod DELETE 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data PATCH #

type-level PATCH-method tag

Instances

Instances details
IsMethod PATCH 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data OPTIONS #

type-level OPTIONS-method tag

Instances

Instances details
IsMethod OPTIONS 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data HEAD #

type-level HEAD-method tag

Instances

Instances details
IsMethod HEAD 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

data TRACE #

type-level TRACE-method tag

Instances

Instances details
IsMethod TRACE 
Instance details

Defined in Mig.Core.Types.Route

Methods

toMethod :: Method #

safe URLs

type family UrlOf a where ... #

Converts route type to URL function

Equations

UrlOf (Send method m a) = Url 
UrlOf (Query name value -> b) = Query name value -> UrlOf b 
UrlOf (Optional name value -> b) = Optional name value -> UrlOf b 
UrlOf (Capture name value -> b) = Capture name value -> UrlOf b 
UrlOf (QueryFlag name -> b) = QueryFlag name -> UrlOf b 
UrlOf (Header name value -> b) = UrlOf b 
UrlOf (OptionalHeader name value -> b) = UrlOf b 
UrlOf (Body media value -> b) = UrlOf b 
UrlOf (Cookie value -> b) = UrlOf b 
UrlOf (PathInfo -> b) = UrlOf b 
UrlOf (FullPathInfo -> b) = UrlOf b 
UrlOf (RawRequest -> b) = UrlOf b 
UrlOf (IsSecure -> b) = UrlOf b 
UrlOf (a, b) = (UrlOf a, UrlOf b) 
UrlOf (a, b, c) = (UrlOf a, UrlOf b, UrlOf c) 
UrlOf (a, b, c, d) = (UrlOf a, UrlOf b, UrlOf c, UrlOf d) 
UrlOf (a, b, c, d, e) = (UrlOf a, UrlOf b, UrlOf c, UrlOf d, UrlOf e) 
UrlOf (a, b, c, d, e, f) = (UrlOf a, UrlOf b, UrlOf c, UrlOf d, UrlOf e, UrlOf f) 
UrlOf (a :| b) = UrlOf a :| UrlOf b 

class ToUrl a where #

Converts server to safe url. We can use it to generate safe URL constructors to be used in HTML templates An example of how we can create safe URL's. Note that order of URL's should be the same as in server definition:

type GreetingRoute = Get Html
type BlogPostRoute = Optional "id" BlogPostId -> Get Html
type ListPostsRoute = Get Html

data Routes = Routes
  { greeting :: GreetingRoute
  , blogPost :: BlogPostRoute
  , listPosts :: ListPostsRoute
  }

-- URLs

data Urls = Urls
  { greeting :: UrlOf GreetingRoute
  , blogPost :: UrlOf BlogPostRoute
  , listPosts :: UrlOf ListPostsRoute
  }

{\-| Site URL's
URL's should be listed in the same order as they appear in the server
-\}
urls :: Urls
urls = Urls{..}
  where
    greeting
      :| blogPost
      :| listPosts
        toUrl (server undefined)

Methods

toUrl :: forall (m :: Type -> Type). Server m -> a #

mapUrl :: (Url -> Url) -> a -> a #

urlArity :: Int #

Instances

Instances details
ToUrl Url 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Url #

mapUrl :: (Url -> Url) -> Url -> Url #

urlArity :: Int #

(ToUrl a, ToUrl b) => ToUrl (a :| b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> a :| b #

mapUrl :: (Url -> Url) -> (a :| b) -> a :| b #

urlArity :: Int #

(KnownSymbol sym, ToHttpApiData a, ToUrl b) => ToUrl (Capture sym a -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Capture sym a -> b #

mapUrl :: (Url -> Url) -> (Capture sym a -> b) -> Capture sym a -> b #

urlArity :: Int #

(KnownSymbol sym, ToHttpApiData a, ToUrl b) => ToUrl (Optional sym a -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Optional sym a -> b #

mapUrl :: (Url -> Url) -> (Optional sym a -> b) -> Optional sym a -> b #

urlArity :: Int #

(KnownSymbol sym, ToHttpApiData a, ToUrl b) => ToUrl (Query sym a -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Query sym a -> b #

mapUrl :: (Url -> Url) -> (Query sym a -> b) -> Query sym a -> b #

urlArity :: Int #

(KnownSymbol sym, ToUrl b) => ToUrl (QueryFlag sym -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> QueryFlag sym -> b #

mapUrl :: (Url -> Url) -> (QueryFlag sym -> b) -> QueryFlag sym -> b #

urlArity :: Int #

(ToUrl a, ToUrl b) => ToUrl (a, b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> (a, b) #

mapUrl :: (Url -> Url) -> (a, b) -> (a, b) #

urlArity :: Int #

(ToUrl a, ToUrl b, ToUrl c) => ToUrl (a, b, c) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> (a, b, c) #

mapUrl :: (Url -> Url) -> (a, b, c) -> (a, b, c) #

urlArity :: Int #

(ToUrl a, ToUrl b, ToUrl c, ToUrl d) => ToUrl (a, b, c, d) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> (a, b, c, d) #

mapUrl :: (Url -> Url) -> (a, b, c, d) -> (a, b, c, d) #

urlArity :: Int #

data Url #

Url-template type.

Constructors

Url 

Fields

Instances

Instances details
ToJSON Url 
Instance details

Defined in Mig.Core.Class.Url

ToUrl Url 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Url #

mapUrl :: (Url -> Url) -> Url -> Url #

urlArity :: Int #

renderUrl :: IsString a => Url -> a #

Render URL to string-like value.

TODO: use Text.Builder

data a :| b #

Infix synonym for pair. It can be useful to stack together many client functions in the output of toClient function.

Constructors

a :| b 

Instances

Instances details
(ToUrl a, ToUrl b) => ToUrl (a :| b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> a :| b #

mapUrl :: (Url -> Url) -> (a :| b) -> a :| b #

urlArity :: Int #

(MapRequest a, MapRequest b) => MapRequest (a :| b) 
Instance details

Defined in Mig.Client

Methods

mapRequest :: (Request -> Request) -> (a :| b) -> a :| b

mapCapture :: (CaptureMap -> CaptureMap) -> (a :| b) -> a :| b

(ToClient a, ToClient b) => ToClient (a :| b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> a :| b #

clientArity :: Int #

path and query

Build API for routes with queries and captures. Use monoid to combine several routes together.

(/.) :: ToServer a => Path -> a -> Server (MonadOf a) infixr 4 #

Constructs server which can handle given path. Example:

"api/v1/get/info" /. handleInfo

For captures we use wild-cards:

"api/v1/get/info/*" /. handleInfo

And handle info has capture argument:

handleInfo :: Capture "nameA" -> Get IO (Resp Json value)

The name for the capture is derived from the type signature of the route handler. Note that if capture is in the last position of the path we can omit wild cards. The proper amount of captures will be derived from the type signature of the handler.

newtype Capture (sym :: Symbol) a #

Argument of capture from the query.

"api/route/{foo} if api/route/bar passed"  ==> (Capture bar) :: Capture "Foo" barType

Constructors

Capture a 

Instances

Instances details
(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Capture sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Capture sym a -> b) -> ServerFun (MonadOf (Capture sym a -> b)) -> ServerFun (MonadOf (Capture sym a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Capture sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Capture sym a -> b) -> ServerFun (MonadOf (Capture sym a -> b)) #

(KnownSymbol sym, ToHttpApiData a, ToUrl b) => ToUrl (Capture sym a -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Capture sym a -> b #

mapUrl :: (Url -> Url) -> (Capture sym a -> b) -> Capture sym a -> b #

urlArity :: Int #

FromClient b => FromClient (Capture sym a -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (Capture sym a -> b) #

Methods

fromClient :: (Capture sym a -> b) -> ClientResult (Capture sym a -> b) #

(KnownSymbol sym, ToHttpApiData a, ToClient b) => ToClient (Capture sym a -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> Capture sym a -> b #

clientArity :: Int #

type ClientResult (Capture sym a -> b) 
Instance details

Defined in Mig.Client

type ClientResult (Capture sym a -> b) = a -> ClientResult b

newtype Query (sym :: Symbol) a #

Required URL parameter query.

"api/route?foo=bar" ==> (Query bar) :: Query "foo" a

Constructors

Query a 

Instances

Instances details
(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Query sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Query sym a -> b) -> ServerFun (MonadOf (Query sym a -> b)) -> ServerFun (MonadOf (Query sym a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Query sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Query sym a -> b) -> ServerFun (MonadOf (Query sym a -> b)) #

(KnownSymbol sym, ToHttpApiData a, ToUrl b) => ToUrl (Query sym a -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Query sym a -> b #

mapUrl :: (Url -> Url) -> (Query sym a -> b) -> Query sym a -> b #

urlArity :: Int #

FromClient b => FromClient (Query sym a -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (Query sym a -> b) #

Methods

fromClient :: (Query sym a -> b) -> ClientResult (Query sym a -> b) #

(KnownSymbol sym, ToHttpApiData a, ToClient b) => ToClient (Query sym a -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> Query sym a -> b #

clientArity :: Int #

type ClientResult (Query sym a -> b) 
Instance details

Defined in Mig.Client

type ClientResult (Query sym a -> b) = a -> ClientResult b

newtype QueryFlag (sym :: Symbol) #

Query flag. It is a boolean value in the URL-query. If it is missing it is False if it is in the query but does not have any value it is True. Also it can have values true/false in the query.

Constructors

QueryFlag Bool 

Instances

Instances details
(ToPlugin b, KnownSymbol sym) => ToPlugin (QueryFlag sym -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (QueryFlag sym -> b) -> ServerFun (MonadOf (QueryFlag sym -> b)) -> ServerFun (MonadOf (QueryFlag sym -> b)) #

(ToRoute b, KnownSymbol sym) => ToRoute (QueryFlag sym -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (QueryFlag sym -> b) -> ServerFun (MonadOf (QueryFlag sym -> b)) #

(KnownSymbol sym, ToUrl b) => ToUrl (QueryFlag sym -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> QueryFlag sym -> b #

mapUrl :: (Url -> Url) -> (QueryFlag sym -> b) -> QueryFlag sym -> b #

urlArity :: Int #

FromClient b => FromClient (QueryFlag a -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (QueryFlag a -> b) #

Methods

fromClient :: (QueryFlag a -> b) -> ClientResult (QueryFlag a -> b) #

(KnownSymbol sym, ToClient b) => ToClient (QueryFlag sym -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> QueryFlag sym -> b #

clientArity :: Int #

type ClientResult (QueryFlag a -> b) 
Instance details

Defined in Mig.Client

newtype Optional (sym :: Symbol) a #

Optional URL parameter query.

"api/route?foo=bar" ==> (Optional maybeBar) :: Query "foo" a

Constructors

Optional (Maybe a) 

Instances

Instances details
(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Optional sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Optional sym a -> b) -> ServerFun (MonadOf (Optional sym a -> b)) -> ServerFun (MonadOf (Optional sym a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Optional sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Optional sym a -> b) -> ServerFun (MonadOf (Optional sym a -> b)) #

(KnownSymbol sym, ToHttpApiData a, ToUrl b) => ToUrl (Optional sym a -> b) 
Instance details

Defined in Mig.Core.Class.Url

Methods

toUrl :: forall (m :: Type -> Type). Server m -> Optional sym a -> b #

mapUrl :: (Url -> Url) -> (Optional sym a -> b) -> Optional sym a -> b #

urlArity :: Int #

FromClient b => FromClient (Optional sym a -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (Optional sym a -> b) #

Methods

fromClient :: (Optional sym a -> b) -> ClientResult (Optional sym a -> b) #

(KnownSymbol sym, ToHttpApiData a, ToClient b) => ToClient (Optional sym a -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> Optional sym a -> b #

clientArity :: Int #

type ClientResult (Optional sym a -> b) 
Instance details

Defined in Mig.Client

type ClientResult (Optional sym a -> b) = Maybe a -> ClientResult b

newtype Header (sym :: Symbol) a #

Reads value from the required header by name. For example if the request has header:

"foo": "bar"

It reads the value:

(Header bar) :: Header "foo" barType

Constructors

Header a 

Instances

Instances details
(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Header sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Header sym a -> b) -> ServerFun (MonadOf (Header sym a -> b)) -> ServerFun (MonadOf (Header sym a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (Header sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Header sym a -> b) -> ServerFun (MonadOf (Header sym a -> b)) #

FromClient b => FromClient (Header sym a -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (Header sym a -> b) #

Methods

fromClient :: (Header sym a -> b) -> ClientResult (Header sym a -> b) #

(KnownSymbol sym, ToHttpApiData a, ToClient b) => ToClient (Header sym a -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> Header sym a -> b #

clientArity :: Int #

type ClientResult (Header sym a -> b) 
Instance details

Defined in Mig.Client

type ClientResult (Header sym a -> b) = a -> ClientResult b

newtype OptionalHeader (sym :: Symbol) a #

Reads value from the optional header by name. For example if the request has header:

"foo": "bar"

It reads the value:

(OptionalHeader (Just bar)) :: OptionalHeader "foo" barType

Constructors

OptionalHeader (Maybe a) 

Instances

Instances details
(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

(FromHttpApiData a, ToParamSchema a, ToRoute b, KnownSymbol sym) => ToRoute (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Core.Class.Route

FromClient b => FromClient (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (OptionalHeader sym a -> b) #

Methods

fromClient :: (OptionalHeader sym a -> b) -> ClientResult (OptionalHeader sym a -> b) #

(KnownSymbol sym, ToHttpApiData a, ToClient b) => ToClient (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> OptionalHeader sym a -> b #

clientArity :: Int #

type ClientResult (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Client

type ClientResult (OptionalHeader sym a -> b) = Maybe a -> ClientResult b

newtype Cookie a #

Reads a cookie. It's an optional header with name Cookie. The cookie is URL-encoded and read with instnace of FromForm class.

data MyCookie = MyCookie
  { secret :: Text
  , count :: Int
  }
  deriving (Generic, FromForm)

> "secret=lolkek&count=101"

(Cookie (Just (MyCookie { secret = "lolkek", count = 101 }))) :: Cookie MyCookie

Constructors

Cookie (Maybe a) 

Instances

Instances details
(FromForm a, ToPlugin b) => ToPlugin (Cookie a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Cookie a -> b) -> ServerFun (MonadOf (Cookie a -> b)) -> ServerFun (MonadOf (Cookie a -> b)) #

(FromForm a, ToRoute b) => ToRoute (Cookie a -> b) 
Instance details

Defined in Mig.Core.Class.Route

Methods

toRouteInfo :: RouteInfo -> RouteInfo #

toRouteFun :: (Cookie a -> b) -> ServerFun (MonadOf (Cookie a -> b)) #

newtype PathInfo #

Reads current path info.

"api/foo/bar" ==> PathInfo ["foo", "bar"]

Constructors

PathInfo [Text] 

Instances

Instances details
ToPlugin a => ToPlugin (PathInfo -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

ToRoute b => ToRoute (PathInfo -> b) 
Instance details

Defined in Mig.Core.Class.Route

FromClient b => FromClient (PathInfo -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (PathInfo -> b) #

Methods

fromClient :: (PathInfo -> b) -> ClientResult (PathInfo -> b) #

ToClient b => ToClient (PathInfo -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> PathInfo -> b #

clientArity :: Int #

type ClientResult (PathInfo -> b) 
Instance details

Defined in Mig.Client

newtype FullPathInfo #

Reads current full-path info with queries.

"api/foo/bar?param=value" ==> FullPathInfo "api/foo/bar?param=value"

Constructors

FullPathInfo Text 

Instances

Instances details
ToPlugin a => ToPlugin (FullPathInfo -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

ToRoute b => ToRoute (FullPathInfo -> b) 
Instance details

Defined in Mig.Core.Class.Route

newtype RawRequest #

Read low-level request. Note that it does not affect the API schema

Constructors

RawRequest Request 

Instances

Instances details
ToPlugin a => ToPlugin (RawRequest -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

ToRoute b => ToRoute (RawRequest -> b) 
Instance details

Defined in Mig.Core.Class.Route

FromClient b => FromClient (RawRequest -> b) 
Instance details

Defined in Mig.Client

Associated Types

type ClientResult (RawRequest -> b) #

Methods

fromClient :: (RawRequest -> b) -> ClientResult (RawRequest -> b) #

ToClient b => ToClient (RawRequest -> b) 
Instance details

Defined in Mig.Client

Methods

toClient :: forall (m :: Type -> Type). Server m -> RawRequest -> b #

clientArity :: Int #

type ClientResult (RawRequest -> b) 
Instance details

Defined in Mig.Client

response

How to modify response and attach specific info to it

specific cases

staticFiles :: forall (m :: Type -> Type). MonadIO m => [(FilePath, ByteString)] -> Server m #

Serves static files. The file path is a path to where to server the file. The media-type is derived from the extension. There is a special case if we need to server the file from the rooot of the server we can omit everything from the path but keep extension. Otherwise it is not able to derive the media type.

It is convenient to use it with function embedRecursiveDir from the library file-embed or file-embed-lzma.

Plugins

data Plugin (m :: Type -> Type) #

Plugin can convert all routes of the server. It is wrapper on top of ServerFun m -> ServerFun m. We can apply plugins to servers with applyPlugin function also plugin has Monoid instance which is like Monoid.Endo or functional composition (.).

Constructors

Plugin 

Fields

Instances

Instances details
Monoid (Plugin m) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

mempty :: Plugin m #

mappend :: Plugin m -> Plugin m -> Plugin m #

mconcat :: [Plugin m] -> Plugin m #

Semigroup (Plugin m) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

(<>) :: Plugin m -> Plugin m -> Plugin m #

sconcat :: NonEmpty (Plugin m) -> Plugin m #

stimes :: Integral b => b -> Plugin m -> Plugin m #

MonadIO m => ToPlugin (Plugin m) 
Instance details

Defined in Mig.Core.Class.Plugin

type PluginFun (m :: Type -> Type) = ServerFun m -> ServerFun m #

Low-level plugin function.

class MonadIO (MonadOf f) => ToPlugin f where #

Values that can represent a plugin. We use various newtype-wrappers to query type-safe info from request.

Instances

Instances details
MonadIO m => ToPlugin (Plugin m) 
Instance details

Defined in Mig.Core.Class.Plugin

MonadIO m => ToPlugin (PluginFun m) 
Instance details

Defined in Mig.Core.Class.Plugin

ToPlugin a => ToPlugin (RawResponse -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

(FromReqBody ty a, ToSchema a, ToPlugin b) => ToPlugin (Body ty a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Body ty a -> b) -> ServerFun (MonadOf (Body ty a -> b)) -> ServerFun (MonadOf (Body ty a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Capture sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Capture sym a -> b) -> ServerFun (MonadOf (Capture sym a -> b)) -> ServerFun (MonadOf (Capture sym a -> b)) #

(FromForm a, ToPlugin b) => ToPlugin (Cookie a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Cookie a -> b) -> ServerFun (MonadOf (Cookie a -> b)) -> ServerFun (MonadOf (Cookie a -> b)) #

ToPlugin a => ToPlugin (FullPathInfo -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Header sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Header sym a -> b) -> ServerFun (MonadOf (Header sym a -> b)) -> ServerFun (MonadOf (Header sym a -> b)) #

ToPlugin a => ToPlugin (IsSecure -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Optional sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Optional sym a -> b) -> ServerFun (MonadOf (Optional sym a -> b)) -> ServerFun (MonadOf (Optional sym a -> b)) #

(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (OptionalHeader sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

ToPlugin a => ToPlugin (PathInfo -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

(FromHttpApiData a, ToParamSchema a, ToPlugin b, KnownSymbol sym) => ToPlugin (Query sym a -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Query sym a -> b) -> ServerFun (MonadOf (Query sym a -> b)) -> ServerFun (MonadOf (Query sym a -> b)) #

(ToPlugin b, KnownSymbol sym) => ToPlugin (QueryFlag sym -> b) 
Instance details

Defined in Mig.Core.Class.Plugin

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (QueryFlag sym -> b) -> ServerFun (MonadOf (QueryFlag sym -> b)) -> ServerFun (MonadOf (QueryFlag sym -> b)) #

ToPlugin a => ToPlugin (RawRequest -> a) 
Instance details

Defined in Mig.Core.Class.Plugin

(FromJSON a, ToSchema a, ToPlugin b) => ToPlugin (Body a -> b) Source # 
Instance details

Defined in Mig.Extra.Server.Json

Methods

toPluginInfo :: RouteInfo -> RouteInfo #

toPluginFun :: (Body a -> b) -> ServerFun (MonadOf (Body a -> b)) -> ServerFun (MonadOf (Body a -> b)) #

applyPlugin :: ToPlugin f => f -> Server (MonadOf f) -> Server (MonadOf f) #

Applies plugin to all routes of the server.

($:) :: ToPlugin f => f -> Server (MonadOf f) -> Server (MonadOf f) #

Infix operator for applyPlugin

prependServerAction :: MonadIO m => m () -> Plugin m #

Prepends action to the server

appendServerAction :: MonadIO m => m () -> Plugin m #

Post appends action to the server

processResponse :: MonadIO m => (m (Maybe Response) -> m (Maybe Response)) -> Plugin m #

Applies transformation to the response

Low-level types

data Request #

Http request

Instances

Instances details
MonadIO m => ToPlugin (PluginFun m) 
Instance details

Defined in Mig.Core.Class.Plugin

data Response #

Http response

Instances

Instances details
Show Response 
Instance details

Defined in Mig.Core.Types.Http

Eq Response 
Instance details

Defined in Mig.Core.Types.Http

IsResp Response 
Instance details

Defined in Mig.Core.Class.Response

Associated Types

type RespBody Response #

type RespError Response #

type RespMedia Response #

MonadIO m => ToPlugin (PluginFun m) 
Instance details

Defined in Mig.Core.Class.Plugin

type RespBody Response 
Instance details

Defined in Mig.Core.Class.Response

type RespError Response 
Instance details

Defined in Mig.Core.Class.Response

type RespMedia Response 
Instance details

Defined in Mig.Core.Class.Response

okResponse :: forall {k} (mime :: k) a. ToRespBody mime a => a -> Response #

Respond with ok 200-status

badResponse :: forall {k} (mime :: k) a. ToRespBody mime a => Status -> a -> Response #

Bad response qith given status

badRequest :: forall {k} (media :: k) a. ToRespBody media a => a -> Response #

Bad request response

type ServerFun (m :: Type -> Type) = Request -> m (Maybe Response) #

Low-level representation of the server. Missing route for a given request returns Nothing.

Render

Render Reader-IO monad servers to IO servers.

class Monad m => HasServer (m :: Type -> Type) where #

Class contains types which can be converted to IO-based server to run as with WAI-interface.

We can run plain IO-servers and ReaderT over IO based servers. Readers can be wrapped in newtypes. In that case we can derive automatically HasServer instance.

Associated Types

type ServerResult (m :: Type -> Type) #

Instances

Instances details
HasServer IO 
Instance details

Defined in Mig.Core.Class.Server

Associated Types

type ServerResult IO #

HasServer (ReaderT env IO) 
Instance details

Defined in Mig.Core.Class.Server

Associated Types

type ServerResult (ReaderT env IO) #

HasServer (ReaderT env (ExceptT Text IO)) 
Instance details

Defined in Mig.Core.Class.Server

Associated Types

type ServerResult (ReaderT env (ExceptT Text IO)) #

fromReader :: env -> Server (ReaderT env IO) -> Server IO #

Render reader server to IO-based server

Convertes

class ToText a where #

Values convertible to lazy text

Methods

toText :: a -> Text #

Instances

Instances details
ToText Text 
Instance details

Defined in Mig.Core.Types.Http

Methods

toText :: Text -> Text #

ToText Text 
Instance details

Defined in Mig.Core.Types.Http

Methods

toText :: Text -> Text0 #

ToText String 
Instance details

Defined in Mig.Core.Types.Http

Methods

toText :: String -> Text #

ToText Float 
Instance details

Defined in Mig.Core.Types.Http

Methods

toText :: Float -> Text #

ToText Int 
Instance details

Defined in Mig.Core.Types.Http

Methods

toText :: Int -> Text #

Server

mapRouteInfo :: forall (m :: Type -> Type). (RouteInfo -> RouteInfo) -> Server m -> Server m #

Maps over route API-information

mapServerFun :: (ServerFun m -> ServerFun n) -> Server m -> Server n #

Applies server function to all routes

mapResponse :: forall (m :: Type -> Type). Functor m => (Response -> Response) -> Server m -> Server m #

Mapps response of the server

atPath :: forall (m :: Type -> Type). Path -> Server m -> Server m #

Sub-server for a server on given path it might be usefule to emulate links from one route to another within the server or reuse part of the server inside another server.

filterPath :: forall (m :: Type -> Type). (Path -> Bool) -> Server m -> Server m #

getServerPaths :: forall (m :: Type -> Type). Server m -> [Path] #

Returns a list of all paths in the server

addPathLink :: forall (m :: Type -> Type). Path -> Path -> Server m -> Server m #

Links one route of the server to another so that every call to first path is redirected to the second path

OpenApi

toOpenApi :: forall (m :: Type -> Type). Server m -> OpenApi #

Reads OpenApi schema for a server

setDescription :: forall (m :: Type -> Type). Text -> Server m -> Server m #

Sets description of the route

describeInputs :: forall (m :: Type -> Type). [(Text, Text)] -> Server m -> Server m #

Appends descriptiton for the inputs. It passes pairs for (input-name, input-description). special name request-body is dedicated to request body input nd raw-input is dedicated to raw input

setSummary :: forall (m :: Type -> Type). Text -> Server m -> Server m #

Sets summary of the route

class IsString a where #

Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).

Methods

fromString :: String -> a #

Instances

Instances details
IsString Key 
Instance details

Defined in Data.Aeson.Key

Methods

fromString :: String -> Key #

IsString Value 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

fromString :: String -> Value #

IsString AttributeValue 
Instance details

Defined in Text.Blaze.Internal

IsString ChoiceString 
Instance details

Defined in Text.Blaze.Internal

IsString StaticString 
Instance details

Defined in Text.Blaze.Internal

IsString Tag 
Instance details

Defined in Text.Blaze.Internal

Methods

fromString :: String -> Tag #

IsString ByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Internal.Type

IsString ByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Lazy.Internal

IsString ShortByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Short.Internal

IsString MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

IsString IP 
Instance details

Defined in Data.IP.Addr

Methods

fromString :: String -> IP #

IsString IPv4 
Instance details

Defined in Data.IP.Addr

Methods

fromString :: String -> IPv4 #

IsString IPv6 
Instance details

Defined in Data.IP.Addr

Methods

fromString :: String -> IPv6 #

IsString IPRange 
Instance details

Defined in Data.IP.Range

Methods

fromString :: String -> IPRange #

IsString Path 
Instance details

Defined in Mig.Core.Api

Methods

fromString :: String -> Path #

IsString License 
Instance details

Defined in Data.OpenApi.Internal

Methods

fromString :: String -> License #

IsString Response 
Instance details

Defined in Data.OpenApi.Internal

IsString Server 
Instance details

Defined in Data.OpenApi.Internal

Methods

fromString :: String -> Server #

IsString Tag 
Instance details

Defined in Data.OpenApi.Internal

Methods

fromString :: String -> Tag #

IsString Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

fromString :: String -> Doc #

IsString Builder

Performs replacement on invalid scalar values:

>>> :set -XOverloadedStrings
>>> "\55555" :: Builder
"\65533"
Instance details

Defined in Data.Text.Internal.Builder

Methods

fromString :: String -> Builder #

IsString ShortText

Note: Surrogate pairs ([U+D800 .. U+DFFF]) in string literals are replaced by U+FFFD.

This matches the behaviour of IsString instance for Text.

Instance details

Defined in Data.Text.Short.Internal

IsString (Encoding' a)

Since: aeson-2.2.0.0

Instance details

Defined in Data.Aeson.Encoding.Internal

Methods

fromString :: String -> Encoding' a #

IsString a => IsString (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Identity a #

a ~ () => IsString (MarkupM a) 
Instance details

Defined in Text.Blaze.Internal

Methods

fromString :: String -> MarkupM a #

(IsString s, FoldCase s) => IsString (CI s) 
Instance details

Defined in Data.CaseInsensitive.Internal

Methods

fromString :: String -> CI s #

a ~ Char => IsString (Seq a)

Since: containers-0.5.7

Instance details

Defined in Data.Sequence.Internal

Methods

fromString :: String -> Seq a #

a ~ Char => IsString (DNonEmpty a) 
Instance details

Defined in Data.DList.DNonEmpty.Internal

Methods

fromString :: String -> DNonEmpty a #

a ~ Char => IsString (DList a) 
Instance details

Defined in Data.DList.Internal

Methods

fromString :: String -> DList a #

(IsString a, Hashable a) => IsString (Hashed a) 
Instance details

Defined in Data.Hashable.Class

Methods

fromString :: String -> Hashed a #

IsString (AddrRange IPv4) 
Instance details

Defined in Data.IP.Range

IsString (AddrRange IPv6) 
Instance details

Defined in Data.IP.Range

IsString a => IsString (Referenced a) 
Instance details

Defined in Data.OpenApi.Internal

Methods

fromString :: String -> Referenced a #

IsString (Doc a) 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

fromString :: String -> Doc a #

a ~ Char => IsString [a]

(a ~ Char) context was introduced in 4.9.0.0

Since: base-2.1

Instance details

Defined in Data.String

Methods

fromString :: String -> [a] #

IsString a => IsString (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Const a b #

IsString a => IsString (Tagged s a) 
Instance details

Defined in Data.Tagged

Methods

fromString :: String -> Tagged s a #

class Generic a #

Representable types of kind *. This class is derivable in GHC with the DeriveGeneric flag on.

A Generic instance must satisfy the following laws:

from . toid
to . fromid

Minimal complete definition

from, to

Instances

Instances details
Generic Value 
Instance details

Defined in Data.Aeson.Types.Internal

Associated Types

type Rep Value :: Type -> Type #

Methods

from :: Value -> Rep Value x #

to :: Rep Value x -> Value #

Generic All 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep All :: Type -> Type #

Methods

from :: All -> Rep All x #

to :: Rep All x -> All #

Generic Any 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep Any :: Type -> Type #

Methods

from :: Any -> Rep Any x #

to :: Rep Any x -> Any #

Generic Version 
Instance details

Defined in Data.Version

Associated Types

type Rep Version :: Type -> Type #

Methods

from :: Version -> Rep Version x #

to :: Rep Version x -> Version #

Generic Void 
Instance details

Defined in Data.Void

Associated Types

type Rep Void :: Type -> Type #

Methods

from :: Void -> Rep Void x #

to :: Rep Void x -> Void #

Generic ByteOrder 
Instance details

Defined in GHC.ByteOrder

Associated Types

type Rep ByteOrder :: Type -> Type #

Generic Fingerprint 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Fingerprint :: Type -> Type #

Generic Associativity 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Associativity :: Type -> Type #

Generic DecidedStrictness 
Instance details

Defined in GHC.Generics

Associated Types

type Rep DecidedStrictness :: Type -> Type #

Generic Fixity 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Fixity :: Type -> Type #

Methods

from :: Fixity -> Rep Fixity x #

to :: Rep Fixity x -> Fixity #

Generic SourceStrictness 
Instance details

Defined in GHC.Generics

Associated Types

type Rep SourceStrictness :: Type -> Type #

Generic SourceUnpackedness 
Instance details

Defined in GHC.Generics

Associated Types

type Rep SourceUnpackedness :: Type -> Type #

Generic ExitCode 
Instance details

Defined in GHC.IO.Exception

Associated Types

type Rep ExitCode :: Type -> Type #

Methods

from :: ExitCode -> Rep ExitCode x #

to :: Rep ExitCode x -> ExitCode #

Generic CCFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep CCFlags :: Type -> Type #

Methods

from :: CCFlags -> Rep CCFlags x #

to :: Rep CCFlags x -> CCFlags #

Generic ConcFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep ConcFlags :: Type -> Type #

Generic DebugFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep DebugFlags :: Type -> Type #

Generic DoCostCentres 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep DoCostCentres :: Type -> Type #

Generic DoHeapProfile 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep DoHeapProfile :: Type -> Type #

Generic DoTrace 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep DoTrace :: Type -> Type #

Methods

from :: DoTrace -> Rep DoTrace x #

to :: Rep DoTrace x -> DoTrace #

Generic GCFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep GCFlags :: Type -> Type #

Methods

from :: GCFlags -> Rep GCFlags x #

to :: Rep GCFlags x -> GCFlags #

Generic GiveGCStats 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep GiveGCStats :: Type -> Type #

Generic MiscFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep MiscFlags :: Type -> Type #

Generic ParFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep ParFlags :: Type -> Type #

Methods

from :: ParFlags -> Rep ParFlags x #

to :: Rep ParFlags x -> ParFlags #

Generic ProfFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep ProfFlags :: Type -> Type #

Generic RTSFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep RTSFlags :: Type -> Type #

Methods

from :: RTSFlags -> Rep RTSFlags x #

to :: Rep RTSFlags x -> RTSFlags #

Generic TickyFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep TickyFlags :: Type -> Type #

Generic TraceFlags 
Instance details

Defined in GHC.RTS.Flags

Associated Types

type Rep TraceFlags :: Type -> Type #

Generic SrcLoc 
Instance details

Defined in GHC.Generics

Associated Types

type Rep SrcLoc :: Type -> Type #

Methods

from :: SrcLoc -> Rep SrcLoc x #

to :: Rep SrcLoc x -> SrcLoc #

Generic GCDetails 
Instance details

Defined in GHC.Stats

Associated Types

type Rep GCDetails :: Type -> Type #

Generic RTSStats 
Instance details

Defined in GHC.Stats

Associated Types

type Rep RTSStats :: Type -> Type #

Methods

from :: RTSStats -> Rep RTSStats x #

to :: Rep RTSStats x -> RTSStats #

Generic GeneralCategory 
Instance details

Defined in GHC.Generics

Associated Types

type Rep GeneralCategory :: Type -> Type #

Generic Clock 
Instance details

Defined in System.Clock

Associated Types

type Rep Clock :: Type -> Type #

Methods

from :: Clock -> Rep Clock x #

to :: Rep Clock x -> Clock #

Generic TimeSpec 
Instance details

Defined in System.Clock

Associated Types

type Rep TimeSpec :: Type -> Type #

Methods

from :: TimeSpec -> Rep TimeSpec x #

to :: Rep TimeSpec x -> TimeSpec #

Generic OsChar 
Instance details

Defined in System.OsString.Internal.Types

Associated Types

type Rep OsChar :: Type -> Type #

Methods

from :: OsChar -> Rep OsChar x #

to :: Rep OsChar x -> OsChar #

Generic OsString 
Instance details

Defined in System.OsString.Internal.Types

Associated Types

type Rep OsString :: Type -> Type #

Methods

from :: OsString -> Rep OsString x #

to :: Rep OsString x -> OsString #

Generic PosixChar 
Instance details

Defined in System.OsString.Internal.Types

Associated Types

type Rep PosixChar :: Type -> Type #

Generic PosixString 
Instance details

Defined in System.OsString.Internal.Types

Associated Types

type Rep PosixString :: Type -> Type #

Generic WindowsChar 
Instance details

Defined in System.OsString.Internal.Types

Associated Types

type Rep WindowsChar :: Type -> Type #

Generic WindowsString 
Instance details

Defined in System.OsString.Internal.Types

Associated Types

type Rep WindowsString :: Type -> Type #

Generic ForeignSrcLang 
Instance details

Defined in GHC.ForeignSrcLang.Type

Associated Types

type Rep ForeignSrcLang :: Type -> Type #

Generic Extension 
Instance details

Defined in GHC.LanguageExtensions.Type

Associated Types

type Rep Extension :: Type -> Type #

Generic Ordering 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Ordering :: Type -> Type #

Methods

from :: Ordering -> Rep Ordering x #

to :: Rep Ordering x -> Ordering #

Generic Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Associated Types

type Rep Form :: Type -> Type #

Methods

from :: Form -> Rep Form x #

to :: Rep Form x -> Form #

Generic IP 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IP :: Type -> Type #

Methods

from :: IP -> Rep IP x #

to :: Rep IP x -> IP #

Generic IPv4 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IPv4 :: Type -> Type #

Methods

from :: IPv4 -> Rep IPv4 x #

to :: Rep IPv4 x -> IPv4 #

Generic IPv6 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IPv6 :: Type -> Type #

Methods

from :: IPv6 -> Rep IPv6 x #

to :: Rep IPv6 x -> IPv6 #

Generic IPRange 
Instance details

Defined in Data.IP.Range

Associated Types

type Rep IPRange :: Type -> Type #

Methods

from :: IPRange -> Rep IPRange x #

to :: Rep IPRange x -> IPRange #

Generic Link Source # 
Instance details

Defined in Mig.Extra.Server.Html

Associated Types

type Rep Link :: Type -> Type #

Methods

from :: Link -> Rep Link x #

to :: Rep Link x -> Link #

Generic URI 
Instance details

Defined in Network.URI

Associated Types

type Rep URI :: Type -> Type #

Methods

from :: URI -> Rep URI x #

to :: Rep URI x -> URI #

Generic URIAuth 
Instance details

Defined in Network.URI

Associated Types

type Rep URIAuth :: Type -> Type #

Methods

from :: URIAuth -> Rep URIAuth x #

to :: Rep URIAuth x -> URIAuth #

Generic ApiKeyLocation 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep ApiKeyLocation :: Type -> Type #

Generic ApiKeyParams 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep ApiKeyParams :: Type -> Type #

Generic Callback 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Callback :: Type -> Type #

Methods

from :: Callback -> Rep Callback x #

to :: Rep Callback x -> Callback #

Generic Components 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Components :: Type -> Type #

Generic Contact 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Contact :: Type -> Type #

Methods

from :: Contact -> Rep Contact x #

to :: Rep Contact x -> Contact #

Generic Discriminator 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Discriminator :: Type -> Type #

Generic Encoding 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Encoding :: Type -> Type #

Methods

from :: Encoding -> Rep Encoding x #

to :: Rep Encoding x -> Encoding #

Generic Example 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Example :: Type -> Type #

Methods

from :: Example -> Rep Example x #

to :: Rep Example x -> Example #

Generic ExpressionOrValue 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep ExpressionOrValue :: Type -> Type #

Generic ExternalDocs 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep ExternalDocs :: Type -> Type #

Generic Header 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Header :: Type -> Type #

Methods

from :: Header -> Rep Header x #

to :: Rep Header x -> Header #

Generic HttpSchemeType 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep HttpSchemeType :: Type -> Type #

Generic Info 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Info :: Type -> Type #

Methods

from :: Info -> Rep Info x #

to :: Rep Info x -> Info #

Generic License 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep License :: Type -> Type #

Methods

from :: License -> Rep License x #

to :: Rep License x -> License #

Generic Link 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Link :: Type -> Type #

Methods

from :: Link -> Rep Link x #

to :: Rep Link x -> Link #

Generic MediaTypeObject 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep MediaTypeObject :: Type -> Type #

Generic NamedSchema 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep NamedSchema :: Type -> Type #

Generic OAuth2AuthorizationCodeFlow 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OAuth2AuthorizationCodeFlow :: Type -> Type #

Generic OAuth2ClientCredentialsFlow 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OAuth2ClientCredentialsFlow :: Type -> Type #

Generic OAuth2Flows 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OAuth2Flows :: Type -> Type #

Generic OAuth2ImplicitFlow 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OAuth2ImplicitFlow :: Type -> Type #

Generic OAuth2PasswordFlow 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OAuth2PasswordFlow :: Type -> Type #

Generic OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OpenApi :: Type -> Type #

Methods

from :: OpenApi -> Rep OpenApi x #

to :: Rep OpenApi x -> OpenApi #

Generic OpenApiSpecVersion 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OpenApiSpecVersion :: Type -> Type #

Generic OpenApiType 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OpenApiType :: Type -> Type #

Generic Operation 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Operation :: Type -> Type #

Generic Param 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Param :: Type -> Type #

Methods

from :: Param -> Rep Param x #

to :: Rep Param x -> Param #

Generic ParamLocation 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep ParamLocation :: Type -> Type #

Generic PathItem 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep PathItem :: Type -> Type #

Methods

from :: PathItem -> Rep PathItem x #

to :: Rep PathItem x -> PathItem #

Generic RequestBody 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep RequestBody :: Type -> Type #

Generic Response 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Response :: Type -> Type #

Methods

from :: Response -> Rep Response x #

to :: Rep Response x -> Response #

Generic Responses 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Responses :: Type -> Type #

Generic Schema 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Schema :: Type -> Type #

Methods

from :: Schema -> Rep Schema x #

to :: Rep Schema x -> Schema #

Generic SecurityDefinitions 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep SecurityDefinitions :: Type -> Type #

Generic SecurityScheme 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep SecurityScheme :: Type -> Type #

Generic SecuritySchemeType 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep SecuritySchemeType :: Type -> Type #

Generic Server 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Server :: Type -> Type #

Methods

from :: Server -> Rep Server x #

to :: Rep Server x -> Server #

Generic ServerVariable 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep ServerVariable :: Type -> Type #

Generic Style 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Style :: Type -> Type #

Methods

from :: Style -> Rep Style x #

to :: Rep Style x -> Style #

Generic Tag 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Tag :: Type -> Type #

Methods

from :: Tag -> Rep Tag x #

to :: Rep Tag x -> Tag #

Generic Xml 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep Xml :: Type -> Type #

Methods

from :: Xml -> Rep Xml x #

to :: Rep Xml x -> Xml #

Generic Mode 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep Mode :: Type -> Type #

Methods

from :: Mode -> Rep Mode x #

to :: Rep Mode x -> Mode #

Generic Style 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep Style :: Type -> Type #

Methods

from :: Style -> Rep Style x #

to :: Rep Style x -> Style #

Generic TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep TextDetails :: Type -> Type #

Generic Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Associated Types

type Rep Doc :: Type -> Type #

Methods

from :: Doc -> Rep Doc x #

to :: Rep Doc x -> Doc #

Generic AnnLookup 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep AnnLookup :: Type -> Type #

Generic AnnTarget 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep AnnTarget :: Type -> Type #

Generic Bang 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Bang :: Type -> Type #

Methods

from :: Bang -> Rep Bang x #

to :: Rep Bang x -> Bang #

Generic Body 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Body :: Type -> Type #

Methods

from :: Body -> Rep Body x #

to :: Rep Body x -> Body #

Generic Bytes 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Bytes :: Type -> Type #

Methods

from :: Bytes -> Rep Bytes x #

to :: Rep Bytes x -> Bytes #

Generic Callconv 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Callconv :: Type -> Type #

Methods

from :: Callconv -> Rep Callconv x #

to :: Rep Callconv x -> Callconv #

Generic Clause 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Clause :: Type -> Type #

Methods

from :: Clause -> Rep Clause x #

to :: Rep Clause x -> Clause #

Generic Con 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Con :: Type -> Type #

Methods

from :: Con -> Rep Con x #

to :: Rep Con x -> Con #

Generic Dec 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Dec :: Type -> Type #

Methods

from :: Dec -> Rep Dec x #

to :: Rep Dec x -> Dec #

Generic DecidedStrictness 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep DecidedStrictness :: Type -> Type #

Generic DerivClause 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep DerivClause :: Type -> Type #

Generic DerivStrategy 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep DerivStrategy :: Type -> Type #

Generic DocLoc 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep DocLoc :: Type -> Type #

Methods

from :: DocLoc -> Rep DocLoc x #

to :: Rep DocLoc x -> DocLoc #

Generic Exp 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Exp :: Type -> Type #

Methods

from :: Exp -> Rep Exp x #

to :: Rep Exp x -> Exp #

Generic FamilyResultSig 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep FamilyResultSig :: Type -> Type #

Generic Fixity 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Fixity :: Type -> Type #

Methods

from :: Fixity -> Rep Fixity x #

to :: Rep Fixity x -> Fixity #

Generic FixityDirection 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep FixityDirection :: Type -> Type #

Generic Foreign 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Foreign :: Type -> Type #

Methods

from :: Foreign -> Rep Foreign x #

to :: Rep Foreign x -> Foreign #

Generic FunDep 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep FunDep :: Type -> Type #

Methods

from :: FunDep -> Rep FunDep x #

to :: Rep FunDep x -> FunDep #

Generic Guard 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Guard :: Type -> Type #

Methods

from :: Guard -> Rep Guard x #

to :: Rep Guard x -> Guard #

Generic Info 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Info :: Type -> Type #

Methods

from :: Info -> Rep Info x #

to :: Rep Info x -> Info #

Generic InjectivityAnn 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep InjectivityAnn :: Type -> Type #

Generic Inline 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Inline :: Type -> Type #

Methods

from :: Inline -> Rep Inline x #

to :: Rep Inline x -> Inline #

Generic Lit 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Lit :: Type -> Type #

Methods

from :: Lit -> Rep Lit x #

to :: Rep Lit x -> Lit #

Generic Loc 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Loc :: Type -> Type #

Methods

from :: Loc -> Rep Loc x #

to :: Rep Loc x -> Loc #

Generic Match 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Match :: Type -> Type #

Methods

from :: Match -> Rep Match x #

to :: Rep Match x -> Match #

Generic ModName 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep ModName :: Type -> Type #

Methods

from :: ModName -> Rep ModName x #

to :: Rep ModName x -> ModName #

Generic Module 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Module :: Type -> Type #

Methods

from :: Module -> Rep Module x #

to :: Rep Module x -> Module #

Generic ModuleInfo 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep ModuleInfo :: Type -> Type #

Generic Name 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Name :: Type -> Type #

Methods

from :: Name -> Rep Name x #

to :: Rep Name x -> Name #

Generic NameFlavour 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep NameFlavour :: Type -> Type #

Generic NameSpace 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep NameSpace :: Type -> Type #

Generic OccName 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep OccName :: Type -> Type #

Methods

from :: OccName -> Rep OccName x #

to :: Rep OccName x -> OccName #

Generic Overlap 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Overlap :: Type -> Type #

Methods

from :: Overlap -> Rep Overlap x #

to :: Rep Overlap x -> Overlap #

Generic Pat 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Pat :: Type -> Type #

Methods

from :: Pat -> Rep Pat x #

to :: Rep Pat x -> Pat #

Generic PatSynArgs 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep PatSynArgs :: Type -> Type #

Generic PatSynDir 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep PatSynDir :: Type -> Type #

Generic Phases 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Phases :: Type -> Type #

Methods

from :: Phases -> Rep Phases x #

to :: Rep Phases x -> Phases #

Generic PkgName 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep PkgName :: Type -> Type #

Methods

from :: PkgName -> Rep PkgName x #

to :: Rep PkgName x -> PkgName #

Generic Pragma 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Pragma :: Type -> Type #

Methods

from :: Pragma -> Rep Pragma x #

to :: Rep Pragma x -> Pragma #

Generic Range 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Range :: Type -> Type #

Methods

from :: Range -> Rep Range x #

to :: Rep Range x -> Range #

Generic Role 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Role :: Type -> Type #

Methods

from :: Role -> Rep Role x #

to :: Rep Role x -> Role #

Generic RuleBndr 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep RuleBndr :: Type -> Type #

Methods

from :: RuleBndr -> Rep RuleBndr x #

to :: Rep RuleBndr x -> RuleBndr #

Generic RuleMatch 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep RuleMatch :: Type -> Type #

Generic Safety 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Safety :: Type -> Type #

Methods

from :: Safety -> Rep Safety x #

to :: Rep Safety x -> Safety #

Generic SourceStrictness 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep SourceStrictness :: Type -> Type #

Generic SourceUnpackedness 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep SourceUnpackedness :: Type -> Type #

Generic Specificity 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Specificity :: Type -> Type #

Generic Stmt 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Stmt :: Type -> Type #

Methods

from :: Stmt -> Rep Stmt x #

to :: Rep Stmt x -> Stmt #

Generic TyLit 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep TyLit :: Type -> Type #

Methods

from :: TyLit -> Rep TyLit x #

to :: Rep TyLit x -> TyLit #

Generic TySynEqn 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep TySynEqn :: Type -> Type #

Methods

from :: TySynEqn -> Rep TySynEqn x #

to :: Rep TySynEqn x -> TySynEqn #

Generic Type 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Type :: Type -> Type #

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

Generic TypeFamilyHead 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep TypeFamilyHead :: Type -> Type #

Generic ConstructorInfo 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep ConstructorInfo :: Type -> Type #

Generic ConstructorVariant 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep ConstructorVariant :: Type -> Type #

Generic DatatypeInfo 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep DatatypeInfo :: Type -> Type #

Generic DatatypeVariant 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep DatatypeVariant :: Type -> Type #

Generic FieldStrictness 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep FieldStrictness :: Type -> Type #

Generic Strictness 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep Strictness :: Type -> Type #

Generic Unpackedness 
Instance details

Defined in Language.Haskell.TH.Datatype

Associated Types

type Rep Unpackedness :: Type -> Type #

Generic CompressionLevel 
Instance details

Defined in Codec.Compression.Zlib.Stream

Associated Types

type Rep CompressionLevel :: Type -> Type #

Generic CompressionStrategy 
Instance details

Defined in Codec.Compression.Zlib.Stream

Associated Types

type Rep CompressionStrategy :: Type -> Type #

Generic Format 
Instance details

Defined in Codec.Compression.Zlib.Stream

Associated Types

type Rep Format :: Type -> Type #

Methods

from :: Format -> Rep Format x #

to :: Rep Format x -> Format #

Generic MemoryLevel 
Instance details

Defined in Codec.Compression.Zlib.Stream

Associated Types

type Rep MemoryLevel :: Type -> Type #

Generic Method 
Instance details

Defined in Codec.Compression.Zlib.Stream

Associated Types

type Rep Method :: Type -> Type #

Methods

from :: Method -> Rep Method x #

to :: Rep Method x -> Method #

Generic WindowBits 
Instance details

Defined in Codec.Compression.Zlib.Stream

Associated Types

type Rep WindowBits :: Type -> Type #

Generic () 
Instance details

Defined in GHC.Generics

Associated Types

type Rep () :: Type -> Type #

Methods

from :: () -> Rep () x #

to :: Rep () x -> () #

Generic Bool 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Bool :: Type -> Type #

Methods

from :: Bool -> Rep Bool x #

to :: Rep Bool x -> Bool #

Generic (ZipList a) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep (ZipList a) :: Type -> Type #

Methods

from :: ZipList a -> Rep (ZipList a) x #

to :: Rep (ZipList a) x -> ZipList a #

Generic (Complex a) 
Instance details

Defined in Data.Complex

Associated Types

type Rep (Complex a) :: Type -> Type #

Methods

from :: Complex a -> Rep (Complex a) x #

to :: Rep (Complex a) x -> Complex a #

Generic (Identity a) 
Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep (Identity a) :: Type -> Type #

Methods

from :: Identity a -> Rep (Identity a) x #

to :: Rep (Identity a) x -> Identity a #

Generic (First a) 
Instance details

Defined in Data.Monoid

Associated Types

type Rep (First a) :: Type -> Type #

Methods

from :: First a -> Rep (First a) x #

to :: Rep (First a) x -> First a #

Generic (Last a) 
Instance details

Defined in Data.Monoid

Associated Types

type Rep (Last a) :: Type -> Type #

Methods

from :: Last a -> Rep (Last a) x #

to :: Rep (Last a) x -> Last a #

Generic (Down a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Down a) :: Type -> Type #

Methods

from :: Down a -> Rep (Down a) x #

to :: Rep (Down a) x -> Down a #

Generic (First a) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (First a) :: Type -> Type #

Methods

from :: First a -> Rep (First a) x #

to :: Rep (First a) x -> First a #

Generic (Last a) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (Last a) :: Type -> Type #

Methods

from :: Last a -> Rep (Last a) x #

to :: Rep (Last a) x -> Last a #

Generic (Max a) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (Max a) :: Type -> Type #

Methods

from :: Max a -> Rep (Max a) x #

to :: Rep (Max a) x -> Max a #

Generic (Min a) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (Min a) :: Type -> Type #

Methods

from :: Min a -> Rep (Min a) x #

to :: Rep (Min a) x -> Min a #

Generic (WrappedMonoid m) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (WrappedMonoid m) :: Type -> Type #

Generic (Dual a) 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep (Dual a) :: Type -> Type #

Methods

from :: Dual a -> Rep (Dual a) x #

to :: Rep (Dual a) x -> Dual a #

Generic (Endo a) 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep (Endo a) :: Type -> Type #

Methods

from :: Endo a -> Rep (Endo a) x #

to :: Rep (Endo a) x -> Endo a #

Generic (Product a) 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep (Product a) :: Type -> Type #

Methods

from :: Product a -> Rep (Product a) x #

to :: Rep (Product a) x -> Product a #

Generic (Sum a) 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep (Sum a) :: Type -> Type #

Methods

from :: Sum a -> Rep (Sum a) x #

to :: Rep (Sum a) x -> Sum a #

Generic (Par1 p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Par1 p) :: Type -> Type #

Methods

from :: Par1 p -> Rep (Par1 p) x #

to :: Rep (Par1 p) x -> Par1 p #

Generic (Digit a) 
Instance details

Defined in Data.Sequence.Internal

Associated Types

type Rep (Digit a) :: Type -> Type #

Methods

from :: Digit a -> Rep (Digit a) x #

to :: Rep (Digit a) x -> Digit a #

Generic (Elem a) 
Instance details

Defined in Data.Sequence.Internal

Associated Types

type Rep (Elem a) :: Type -> Type #

Methods

from :: Elem a -> Rep (Elem a) x #

to :: Rep (Elem a) x -> Elem a #

Generic (FingerTree a) 
Instance details

Defined in Data.Sequence.Internal

Associated Types

type Rep (FingerTree a) :: Type -> Type #

Methods

from :: FingerTree a -> Rep (FingerTree a) x #

to :: Rep (FingerTree a) x -> FingerTree a #

Generic (Node a) 
Instance details

Defined in Data.Sequence.Internal

Associated Types

type Rep (Node a) :: Type -> Type #

Methods

from :: Node a -> Rep (Node a) x #

to :: Rep (Node a) x -> Node a #

Generic (ViewL a) 
Instance details

Defined in Data.Sequence.Internal

Associated Types

type Rep (ViewL a) :: Type -> Type #

Methods

from :: ViewL a -> Rep (ViewL a) x #

to :: Rep (ViewL a) x -> ViewL a #

Generic (ViewR a) 
Instance details

Defined in Data.Sequence.Internal

Associated Types

type Rep (ViewR a) :: Type -> Type #

Methods

from :: ViewR a -> Rep (ViewR a) x #

to :: Rep (ViewR a) x -> ViewR a #

Generic (Tree a) 
Instance details

Defined in Data.Tree

Associated Types

type Rep (Tree a) :: Type -> Type #

Methods

from :: Tree a -> Rep (Tree a) x #

to :: Rep (Tree a) x -> Tree a #

Generic (Fix f) 
Instance details

Defined in Data.Fix

Associated Types

type Rep (Fix f) :: Type -> Type #

Methods

from :: Fix f -> Rep (Fix f) x #

to :: Rep (Fix f) x -> Fix f #

Generic (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

Associated Types

type Rep (HistoriedResponse body) :: Type -> Type #

Methods

from :: HistoriedResponse body -> Rep (HistoriedResponse body) x #

to :: Rep (HistoriedResponse body) x -> HistoriedResponse body #

Generic (AddrRange a) 
Instance details

Defined in Data.IP.Range

Associated Types

type Rep (AddrRange a) :: Type -> Type #

Methods

from :: AddrRange a -> Rep (AddrRange a) x #

to :: Rep (AddrRange a) x -> AddrRange a #

Generic (OAuth2Flow p) 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep (OAuth2Flow p) :: Type -> Type #

Methods

from :: OAuth2Flow p -> Rep (OAuth2Flow p) x #

to :: Rep (OAuth2Flow p) x -> OAuth2Flow p #

Generic (Doc a) 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep (Doc a) :: Type -> Type #

Methods

from :: Doc a -> Rep (Doc a) x #

to :: Rep (Doc a) x -> Doc a #

Generic (I a) 
Instance details

Defined in Data.SOP.BasicFunctors

Associated Types

type Rep (I a) :: Type -> Type #

Methods

from :: I a -> Rep (I a) x #

to :: Rep (I a) x -> I a #

Generic (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Associated Types

type Rep (Maybe a) :: Type -> Type #

Methods

from :: Maybe a -> Rep (Maybe a) x #

to :: Rep (Maybe a) x -> Maybe a #

Generic (TyVarBndr flag) 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep (TyVarBndr flag) :: Type -> Type #

Methods

from :: TyVarBndr flag -> Rep (TyVarBndr flag) x #

to :: Rep (TyVarBndr flag) x -> TyVarBndr flag #

Generic (NonEmpty a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (NonEmpty a) :: Type -> Type #

Methods

from :: NonEmpty a -> Rep (NonEmpty a) x #

to :: Rep (NonEmpty a) x -> NonEmpty a #

Generic (Maybe a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Maybe a) :: Type -> Type #

Methods

from :: Maybe a -> Rep (Maybe a) x #

to :: Rep (Maybe a) x -> Maybe a #

Generic (a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a) :: Type -> Type #

Methods

from :: (a) -> Rep (a) x #

to :: Rep (a) x -> (a) #

Generic [a] 
Instance details

Defined in GHC.Generics

Associated Types

type Rep [a] :: Type -> Type #

Methods

from :: [a] -> Rep [a] x #

to :: Rep [a] x -> [a] #

Generic (WrappedMonad m a) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep (WrappedMonad m a) :: Type -> Type #

Methods

from :: WrappedMonad m a -> Rep (WrappedMonad m a) x #

to :: Rep (WrappedMonad m a) x -> WrappedMonad m a #

Generic (Either a b) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Either a b) :: Type -> Type #

Methods

from :: Either a b -> Rep (Either a b) x #

to :: Rep (Either a b) x -> Either a b #

Generic (Proxy t) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Proxy t) :: Type -> Type #

Methods

from :: Proxy t -> Rep (Proxy t) x #

to :: Rep (Proxy t) x -> Proxy t #

Generic (Arg a b) 
Instance details

Defined in Data.Semigroup

Associated Types

type Rep (Arg a b) :: Type -> Type #

Methods

from :: Arg a b -> Rep (Arg a b) x #

to :: Rep (Arg a b) x -> Arg a b #

Generic (U1 p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (U1 p) :: Type -> Type #

Methods

from :: U1 p -> Rep (U1 p) x #

to :: Rep (U1 p) x -> U1 p #

Generic (V1 p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (V1 p) :: Type -> Type #

Methods

from :: V1 p -> Rep (V1 p) x #

to :: Rep (V1 p) x -> V1 p #

Generic (Cofree f a) 
Instance details

Defined in Control.Comonad.Cofree

Associated Types

type Rep (Cofree f a) :: Type -> Type #

Methods

from :: Cofree f a -> Rep (Cofree f a) x #

to :: Rep (Cofree f a) x -> Cofree f a #

Generic (Free f a) 
Instance details

Defined in Control.Monad.Free

Associated Types

type Rep (Free f a) :: Type -> Type #

Methods

from :: Free f a -> Rep (Free f a) x #

to :: Rep (Free f a) x -> Free f a #

Generic (Either a b) 
Instance details

Defined in Data.Strict.Either

Associated Types

type Rep (Either a b) :: Type -> Type #

Methods

from :: Either a b -> Rep (Either a b) x #

to :: Rep (Either a b) x -> Either a b #

Generic (These a b) 
Instance details

Defined in Data.Strict.These

Associated Types

type Rep (These a b) :: Type -> Type #

Methods

from :: These a b -> Rep (These a b) x #

to :: Rep (These a b) x -> These a b #

Generic (Pair a b) 
Instance details

Defined in Data.Strict.Tuple

Associated Types

type Rep (Pair a b) :: Type -> Type #

Methods

from :: Pair a b -> Rep (Pair a b) x #

to :: Rep (Pair a b) x -> Pair a b #

Generic (These a b) 
Instance details

Defined in Data.These

Associated Types

type Rep (These a b) :: Type -> Type #

Methods

from :: These a b -> Rep (These a b) x #

to :: Rep (These a b) x -> These a b #

Generic (a, b) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b) :: Type -> Type #

Methods

from :: (a, b) -> Rep (a, b) x #

to :: Rep (a, b) x -> (a, b) #

Generic (WrappedArrow a b c) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep (WrappedArrow a b c) :: Type -> Type #

Methods

from :: WrappedArrow a b c -> Rep (WrappedArrow a b c) x #

to :: Rep (WrappedArrow a b c) x -> WrappedArrow a b c #

Generic (Kleisli m a b) 
Instance details

Defined in Control.Arrow

Associated Types

type Rep (Kleisli m a b) :: Type -> Type #

Methods

from :: Kleisli m a b -> Rep (Kleisli m a b) x #

to :: Rep (Kleisli m a b) x -> Kleisli m a b #

Generic (Const a b) 
Instance details

Defined in Data.Functor.Const

Associated Types

type Rep (Const a b) :: Type -> Type #

Methods

from :: Const a b -> Rep (Const a b) x #

to :: Rep (Const a b) x -> Const a b #

Generic (Ap f a) 
Instance details

Defined in Data.Monoid

Associated Types

type Rep (Ap f a) :: Type -> Type #

Methods

from :: Ap f a -> Rep (Ap f a) x #

to :: Rep (Ap f a) x -> Ap f a #

Generic (Alt f a) 
Instance details

Defined in Data.Semigroup.Internal

Associated Types

type Rep (Alt f a) :: Type -> Type #

Methods

from :: Alt f a -> Rep (Alt f a) x #

to :: Rep (Alt f a) x -> Alt f a #

Generic (Rec1 f p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Rec1 f p) :: Type -> Type #

Methods

from :: Rec1 f p -> Rep (Rec1 f p) x #

to :: Rep (Rec1 f p) x -> Rec1 f p #

Generic (URec (Ptr ()) p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec (Ptr ()) p) :: Type -> Type #

Methods

from :: URec (Ptr ()) p -> Rep (URec (Ptr ()) p) x #

to :: Rep (URec (Ptr ()) p) x -> URec (Ptr ()) p #

Generic (URec Char p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Char p) :: Type -> Type #

Methods

from :: URec Char p -> Rep (URec Char p) x #

to :: Rep (URec Char p) x -> URec Char p #

Generic (URec Double p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Double p) :: Type -> Type #

Methods

from :: URec Double p -> Rep (URec Double p) x #

to :: Rep (URec Double p) x -> URec Double p #

Generic (URec Float p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Float p) :: Type -> Type #

Methods

from :: URec Float p -> Rep (URec Float p) x #

to :: Rep (URec Float p) x -> URec Float p #

Generic (URec Int p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Int p) :: Type -> Type #

Methods

from :: URec Int p -> Rep (URec Int p) x #

to :: Rep (URec Int p) x -> URec Int p #

Generic (URec Word p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (URec Word p) :: Type -> Type #

Methods

from :: URec Word p -> Rep (URec Word p) x #

to :: Rep (URec Word p) x -> URec Word p #

Generic (Fix p a) 
Instance details

Defined in Data.Bifunctor.Fix

Associated Types

type Rep (Fix p a) :: Type -> Type #

Methods

from :: Fix p a -> Rep (Fix p a) x #

to :: Rep (Fix p a) x -> Fix p a #

Generic (Join p a) 
Instance details

Defined in Data.Bifunctor.Join

Associated Types

type Rep (Join p a) :: Type -> Type #

Methods

from :: Join p a -> Rep (Join p a) x #

to :: Rep (Join p a) x -> Join p a #

Generic (CofreeF f a b) 
Instance details

Defined in Control.Comonad.Trans.Cofree

Associated Types

type Rep (CofreeF f a b) :: Type -> Type #

Methods

from :: CofreeF f a b -> Rep (CofreeF f a b) x #

to :: Rep (CofreeF f a b) x -> CofreeF f a b #

Generic (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

Associated Types

type Rep (FreeF f a b) :: Type -> Type #

Methods

from :: FreeF f a b -> Rep (FreeF f a b) x #

to :: Rep (FreeF f a b) x -> FreeF f a b #

Generic (K a b) 
Instance details

Defined in Data.SOP.BasicFunctors

Associated Types

type Rep (K a b) :: Type -> Type #

Methods

from :: K a b -> Rep (K a b) x #

to :: Rep (K a b) x -> K a b #

Generic (Tagged s b) 
Instance details

Defined in Data.Tagged

Associated Types

type Rep (Tagged s b) :: Type -> Type #

Methods

from :: Tagged s b -> Rep (Tagged s b) x #

to :: Rep (Tagged s b) x -> Tagged s b #

Generic (These1 f g a) 
Instance details

Defined in Data.Functor.These

Associated Types

type Rep (These1 f g a) :: Type -> Type #

Methods

from :: These1 f g a -> Rep (These1 f g a) x #

to :: Rep (These1 f g a) x -> These1 f g a #

Generic (a, b, c) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c) :: Type -> Type #

Methods

from :: (a, b, c) -> Rep (a, b, c) x #

to :: Rep (a, b, c) x -> (a, b, c) #

Generic (Product f g a) 
Instance details

Defined in Data.Functor.Product

Associated Types

type Rep (Product f g a) :: Type -> Type #

Methods

from :: Product f g a -> Rep (Product f g a) x #

to :: Rep (Product f g a) x -> Product f g a #

Generic (Sum f g a) 
Instance details

Defined in Data.Functor.Sum

Associated Types

type Rep (Sum f g a) :: Type -> Type #

Methods

from :: Sum f g a -> Rep (Sum f g a) x #

to :: Rep (Sum f g a) x -> Sum f g a #

Generic ((f :*: g) p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep ((f :*: g) p) :: Type -> Type #

Methods

from :: (f :*: g) p -> Rep ((f :*: g) p) x #

to :: Rep ((f :*: g) p) x -> (f :*: g) p #

Generic ((f :+: g) p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep ((f :+: g) p) :: Type -> Type #

Methods

from :: (f :+: g) p -> Rep ((f :+: g) p) x #

to :: Rep ((f :+: g) p) x -> (f :+: g) p #

Generic (K1 i c p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (K1 i c p) :: Type -> Type #

Methods

from :: K1 i c p -> Rep (K1 i c p) x #

to :: Rep (K1 i c p) x -> K1 i c p #

Generic (a, b, c, d) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d) :: Type -> Type #

Methods

from :: (a, b, c, d) -> Rep (a, b, c, d) x #

to :: Rep (a, b, c, d) x -> (a, b, c, d) #

Generic (Compose f g a) 
Instance details

Defined in Data.Functor.Compose

Associated Types

type Rep (Compose f g a) :: Type -> Type #

Methods

from :: Compose f g a -> Rep (Compose f g a) x #

to :: Rep (Compose f g a) x -> Compose f g a #

Generic ((f :.: g) p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep ((f :.: g) p) :: Type -> Type #

Methods

from :: (f :.: g) p -> Rep ((f :.: g) p) x #

to :: Rep ((f :.: g) p) x -> (f :.: g) p #

Generic (M1 i c f p) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (M1 i c f p) :: Type -> Type #

Methods

from :: M1 i c f p -> Rep (M1 i c f p) x #

to :: Rep (M1 i c f p) x -> M1 i c f p #

Generic (Clown f a b) 
Instance details

Defined in Data.Bifunctor.Clown

Associated Types

type Rep (Clown f a b) :: Type -> Type #

Methods

from :: Clown f a b -> Rep (Clown f a b) x #

to :: Rep (Clown f a b) x -> Clown f a b #

Generic (Flip p a b) 
Instance details

Defined in Data.Bifunctor.Flip

Associated Types

type Rep (Flip p a b) :: Type -> Type #

Methods

from :: Flip p a b -> Rep (Flip p a b) x #

to :: Rep (Flip p a b) x -> Flip p a b #

Generic (Joker g a b) 
Instance details

Defined in Data.Bifunctor.Joker

Associated Types

type Rep (Joker g a b) :: Type -> Type #

Methods

from :: Joker g a b -> Rep (Joker g a b) x #

to :: Rep (Joker g a b) x -> Joker g a b #

Generic (WrappedBifunctor p a b) 
Instance details

Defined in Data.Bifunctor.Wrapped

Associated Types

type Rep (WrappedBifunctor p a b) :: Type -> Type #

Methods

from :: WrappedBifunctor p a b -> Rep (WrappedBifunctor p a b) x #

to :: Rep (WrappedBifunctor p a b) x -> WrappedBifunctor p a b #

Generic ((f :.: g) p) 
Instance details

Defined in Data.SOP.BasicFunctors

Associated Types

type Rep ((f :.: g) p) :: Type -> Type #

Methods

from :: (f :.: g) p -> Rep ((f :.: g) p) x #

to :: Rep ((f :.: g) p) x -> (f :.: g) p #

Generic (a, b, c, d, e) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e) :: Type -> Type #

Methods

from :: (a, b, c, d, e) -> Rep (a, b, c, d, e) x #

to :: Rep (a, b, c, d, e) x -> (a, b, c, d, e) #

Generic (Product f g a b) 
Instance details

Defined in Data.Bifunctor.Product

Associated Types

type Rep (Product f g a b) :: Type -> Type #

Methods

from :: Product f g a b -> Rep (Product f g a b) x #

to :: Rep (Product f g a b) x -> Product f g a b #

Generic (Sum p q a b) 
Instance details

Defined in Data.Bifunctor.Sum

Associated Types

type Rep (Sum p q a b) :: Type -> Type #

Methods

from :: Sum p q a b -> Rep (Sum p q a b) x #

to :: Rep (Sum p q a b) x -> Sum p q a b #

Generic (a, b, c, d, e, f) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f) -> Rep (a, b, c, d, e, f) x #

to :: Rep (a, b, c, d, e, f) x -> (a, b, c, d, e, f) #

Generic (Tannen f p a b) 
Instance details

Defined in Data.Bifunctor.Tannen

Associated Types

type Rep (Tannen f p a b) :: Type -> Type #

Methods

from :: Tannen f p a b -> Rep (Tannen f p a b) x #

to :: Rep (Tannen f p a b) x -> Tannen f p a b #

Generic (a, b, c, d, e, f, g) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g) -> Rep (a, b, c, d, e, f, g) x #

to :: Rep (a, b, c, d, e, f, g) x -> (a, b, c, d, e, f, g) #

Generic (a, b, c, d, e, f, g, h) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h) -> Rep (a, b, c, d, e, f, g, h) x #

to :: Rep (a, b, c, d, e, f, g, h) x -> (a, b, c, d, e, f, g, h) #

Generic (Biff p f g a b) 
Instance details

Defined in Data.Bifunctor.Biff

Associated Types

type Rep (Biff p f g a b) :: Type -> Type #

Methods

from :: Biff p f g a b -> Rep (Biff p f g a b) x #

to :: Rep (Biff p f g a b) x -> Biff p f g a b #

Generic (a, b, c, d, e, f, g, h, i) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i) -> Rep (a, b, c, d, e, f, g, h, i) x #

to :: Rep (a, b, c, d, e, f, g, h, i) x -> (a, b, c, d, e, f, g, h, i) #

Generic (a, b, c, d, e, f, g, h, i, j) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i, j) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i, j) -> Rep (a, b, c, d, e, f, g, h, i, j) x #

to :: Rep (a, b, c, d, e, f, g, h, i, j) x -> (a, b, c, d, e, f, g, h, i, j) #

Generic (a, b, c, d, e, f, g, h, i, j, k) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i, j, k) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i, j, k) -> Rep (a, b, c, d, e, f, g, h, i, j, k) x #

to :: Rep (a, b, c, d, e, f, g, h, i, j, k) x -> (a, b, c, d, e, f, g, h, i, j, k) #

Generic (a, b, c, d, e, f, g, h, i, j, k, l) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i, j, k, l) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Rep (a, b, c, d, e, f, g, h, i, j, k, l) x #

to :: Rep (a, b, c, d, e, f, g, h, i, j, k, l) x -> (a, b, c, d, e, f, g, h, i, j, k, l) #

Generic (a, b, c, d, e, f, g, h, i, j, k, l, m) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i, j, k, l, m) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Rep (a, b, c, d, e, f, g, h, i, j, k, l, m) x #

to :: Rep (a, b, c, d, e, f, g, h, i, j, k, l, m) x -> (a, b, c, d, e, f, g, h, i, j, k, l, m) #

Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i, j, k, l, m, n) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Rep (a, b, c, d, e, f, g, h, i, j, k, l, m, n) x #

to :: Rep (a, b, c, d, e, f, g, h, i, j, k, l, m, n) x -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #

Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) :: Type -> Type #

Methods

from :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Rep (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) x #

to :: Rep (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) x -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #

type String = [Char] #

A String is a list of characters. String constants in Haskell are values of type String.

See Data.List for operations on lists.

data Maybe a #

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.

Constructors

Nothing 
Just a 

Instances

Instances details
FromJSON1 Maybe 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Maybe a) #

liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Maybe a] #

liftOmittedField :: Maybe a -> Maybe (Maybe a) #

ToJSON1 Maybe 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Maybe a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Maybe a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Maybe a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Maybe a] -> Encoding #

liftOmitField :: (a -> Bool) -> Maybe a -> Bool #

MonadFail Maybe

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fail

Methods

fail :: String -> Maybe a #

Foldable Maybe

Since: base-2.1

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => Maybe m -> m #

foldMap :: Monoid m => (a -> m) -> Maybe a -> m #

foldMap' :: Monoid m => (a -> m) -> Maybe a -> m #

foldr :: (a -> b -> b) -> b -> Maybe a -> b #

foldr' :: (a -> b -> b) -> b -> Maybe a -> b #

foldl :: (b -> a -> b) -> b -> Maybe a -> b #

foldl' :: (b -> a -> b) -> b -> Maybe a -> b #

foldr1 :: (a -> a -> a) -> Maybe a -> a #

foldl1 :: (a -> a -> a) -> Maybe a -> a #

toList :: Maybe a -> [a] #

null :: Maybe a -> Bool #

length :: Maybe a -> Int #

elem :: Eq a => a -> Maybe a -> Bool #

maximum :: Ord a => Maybe a -> a #

minimum :: Ord a => Maybe a -> a #

sum :: Num a => Maybe a -> a #

product :: Num a => Maybe a -> a #

Eq1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool #

Ord1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Maybe a -> Maybe b -> Ordering #

Read1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Maybe a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Maybe a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Maybe a] #

Show1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Maybe a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Maybe a] -> ShowS #

Traversable Maybe

Since: base-2.1

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) #

sequenceA :: Applicative f => Maybe (f a) -> f (Maybe a) #

mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) #

sequence :: Monad m => Maybe (m a) -> m (Maybe a) #

Alternative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

empty :: Maybe a #

(<|>) :: Maybe a -> Maybe a -> Maybe a #

some :: Maybe a -> Maybe [a] #

many :: Maybe a -> Maybe [a] #

Applicative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a -> Maybe a #

(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b #

liftA2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #

(*>) :: Maybe a -> Maybe b -> Maybe b #

(<*) :: Maybe a -> Maybe b -> Maybe a #

Functor Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

fmap :: (a -> b) -> Maybe a -> Maybe b #

(<$) :: a -> Maybe b -> Maybe a #

Monad Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b #

(>>) :: Maybe a -> Maybe b -> Maybe b #

return :: a -> Maybe a #

MonadPlus Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

mzero :: Maybe a #

mplus :: Maybe a -> Maybe a -> Maybe a #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a #

Hashable1 Maybe 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Maybe a -> Int #

Generic1 Maybe 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 Maybe :: k -> Type #

Methods

from1 :: forall (a :: k). Maybe a -> Rep1 Maybe a #

to1 :: forall (a :: k). Rep1 Maybe a -> Maybe a #

(Selector s, FromHttpApiData c) => GFromForm (t :: k) (M1 S s (K1 i (Maybe c) :: Type -> Type)) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

gFromForm :: Proxy t -> FormOptions -> Form -> Either Text (M1 S s (K1 i (Maybe c)) x) #

(Selector s, ToHttpApiData c) => GToForm (t :: k) (M1 S s (K1 i (Maybe c) :: Type -> Type)) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

gToForm :: Proxy t -> FormOptions -> M1 S s (K1 i (Maybe c)) x -> Form #

HasAdditionalProperties Schema (Maybe AdditionalProperties) 
Instance details

Defined in Data.OpenApi.Lens

HasAllOf Schema (Maybe [Referenced Schema]) 
Instance details

Defined in Data.OpenApi.Lens

HasAllowEmptyValue Header (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasAllowEmptyValue Param (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasAllowReserved Encoding (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasAllowReserved Param (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasAnyOf Schema (Maybe [Referenced Schema]) 
Instance details

Defined in Data.OpenApi.Lens

HasAttribute Xml (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasAuthorizationCode OAuth2Flows (Maybe (OAuth2Flow OAuth2AuthorizationCodeFlow)) 
Instance details

Defined in Data.OpenApi.Lens

HasClientCredentials OAuth2Flows (Maybe (OAuth2Flow OAuth2ClientCredentialsFlow)) 
Instance details

Defined in Data.OpenApi.Lens

HasContact Info (Maybe Contact) 
Instance details

Defined in Data.OpenApi.Lens

HasContentType Encoding (Maybe MediaType) 
Instance details

Defined in Data.OpenApi.Lens

HasDefault Responses (Maybe (Referenced Response)) 
Instance details

Defined in Data.OpenApi.Lens

HasDefault Schema (Maybe Value) 
Instance details

Defined in Data.OpenApi.Lens

HasDelete PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasDeprecated Header (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasDeprecated Operation (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasDeprecated Param (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasDeprecated Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Example (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription ExternalDocs (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Header (Maybe HeaderName) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Info (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Link (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Operation (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Param (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription PathItem (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription RequestBody (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Schema (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription SecurityScheme (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Server (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Tag (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDiscriminator Schema (Maybe Discriminator) 
Instance details

Defined in Data.OpenApi.Lens

HasEmail Contact (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasEnum Schema (Maybe [Value]) 
Instance details

Defined in Data.OpenApi.Lens

Methods

enum_ :: Lens' Schema (Maybe [Value]) #

HasSchema s Schema => HasEnum s (Maybe [Value]) 
Instance details

Defined in Data.OpenApi.Lens

Methods

enum_ :: Lens' s (Maybe [Value]) #

HasExample Header (Maybe Value) 
Instance details

Defined in Data.OpenApi.Lens

HasExample MediaTypeObject (Maybe Value) 
Instance details

Defined in Data.OpenApi.Lens

HasExample Param (Maybe Value) 
Instance details

Defined in Data.OpenApi.Lens

HasExample Schema (Maybe Value) 
Instance details

Defined in Data.OpenApi.Lens

HasExclusiveMaximum Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasExclusiveMaximum s (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasExclusiveMinimum Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasExclusiveMinimum s (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasExplode Encoding (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasExplode Header (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasExplode Param (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasExternalDocs OpenApi (Maybe ExternalDocs) 
Instance details

Defined in Data.OpenApi.Lens

HasExternalDocs Operation (Maybe ExternalDocs) 
Instance details

Defined in Data.OpenApi.Lens

HasExternalDocs Schema (Maybe ExternalDocs) 
Instance details

Defined in Data.OpenApi.Lens

HasExternalDocs Tag (Maybe ExternalDocs) 
Instance details

Defined in Data.OpenApi.Lens

HasExternalValue Example (Maybe URL) 
Instance details

Defined in Data.OpenApi.Lens

HasFormat Schema (Maybe Format) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasFormat s (Maybe Format) 
Instance details

Defined in Data.OpenApi.Lens

Methods

format :: Lens' s (Maybe Format) #

HasGet PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasHead PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasImplicit OAuth2Flows (Maybe (OAuth2Flow OAuth2ImplicitFlow)) 
Instance details

Defined in Data.OpenApi.Lens

HasItems Schema (Maybe OpenApiItems) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasItems s (Maybe OpenApiItems) 
Instance details

Defined in Data.OpenApi.Lens

HasLicense Info (Maybe License) 
Instance details

Defined in Data.OpenApi.Lens

HasMaxItems Schema (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMaxItems s (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

Methods

maxItems :: Lens' s (Maybe Integer) #

HasMaxLength Schema (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMaxLength s (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

Methods

maxLength :: Lens' s (Maybe Integer) #

HasMaxProperties Schema (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

HasMaximum Schema (Maybe Scientific) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMaximum s (Maybe Scientific) 
Instance details

Defined in Data.OpenApi.Lens

HasMinItems Schema (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMinItems s (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

Methods

minItems :: Lens' s (Maybe Integer) #

HasMinLength Schema (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMinLength s (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

Methods

minLength :: Lens' s (Maybe Integer) #

HasMinProperties Schema (Maybe Integer) 
Instance details

Defined in Data.OpenApi.Lens

HasMinimum Schema (Maybe Scientific) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMinimum s (Maybe Scientific) 
Instance details

Defined in Data.OpenApi.Lens

HasMultipleOf Schema (Maybe Scientific) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasMultipleOf s (Maybe Scientific) 
Instance details

Defined in Data.OpenApi.Lens

HasName Contact (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasName NamedSchema (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasName Xml (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

Methods

name :: Lens' Xml (Maybe Text) #

HasNamespace Xml (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasNot Schema (Maybe (Referenced Schema)) 
Instance details

Defined in Data.OpenApi.Lens

HasNullable Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasOneOf Schema (Maybe [Referenced Schema]) 
Instance details

Defined in Data.OpenApi.Lens

HasOperationId Link (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasOperationId Operation (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasOperationRef Link (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasOptions PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasPassword OAuth2Flows (Maybe (OAuth2Flow OAuth2PasswordFlow)) 
Instance details

Defined in Data.OpenApi.Lens

HasPatch PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasPattern Schema (Maybe Pattern) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasPattern s (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

Methods

pattern :: Lens' s (Maybe Text) #

HasPost PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasPrefix Xml (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

Methods

prefix :: Lens' Xml (Maybe Text) #

HasPut PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasReadOnly Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasRequestBody Link (Maybe ExpressionOrValue) 
Instance details

Defined in Data.OpenApi.Lens

HasRequestBody Operation (Maybe (Referenced RequestBody)) 
Instance details

Defined in Data.OpenApi.Lens

HasRequired Header (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasRequired Param (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasRequired RequestBody (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema Header (Maybe (Referenced Schema)) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema MediaTypeObject (Maybe (Referenced Schema)) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema Param (Maybe (Referenced Schema)) 
Instance details

Defined in Data.OpenApi.Lens

HasServer Link (Maybe Server) 
Instance details

Defined in Data.OpenApi.Lens

HasStyle Encoding (Maybe Style) 
Instance details

Defined in Data.OpenApi.Lens

HasStyle Param (Maybe Style) 
Instance details

Defined in Data.OpenApi.Lens

HasSummary Example (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasSummary Operation (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasSummary PathItem (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasTermsOfService Info (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasTitle Schema (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasTrace PathItem (Maybe Operation) 
Instance details

Defined in Data.OpenApi.Lens

HasType NamedSchema (Maybe OpenApiType) 
Instance details

Defined in Data.OpenApi.Lens

HasType Schema (Maybe OpenApiType) 
Instance details

Defined in Data.OpenApi.Lens

HasUniqueItems Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasUniqueItems s (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

Methods

uniqueItems :: Lens' s (Maybe Bool) #

HasUrl Contact (Maybe URL) 
Instance details

Defined in Data.OpenApi.Lens

Methods

url :: Lens' Contact (Maybe URL) #

HasUrl License (Maybe URL) 
Instance details

Defined in Data.OpenApi.Lens

Methods

url :: Lens' License (Maybe URL) #

HasValue Example (Maybe Value) 
Instance details

Defined in Data.OpenApi.Lens

HasWrapped Xml (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

Methods

wrapped :: Lens' Xml (Maybe Bool) #

HasWriteOnly Schema (Maybe Bool) 
Instance details

Defined in Data.OpenApi.Lens

HasXml Schema (Maybe Xml) 
Instance details

Defined in Data.OpenApi.Lens

Methods

xml :: Lens' Schema (Maybe Xml) #

Lift a => Lift (Maybe a :: Type) 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Quote m => Maybe a -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Maybe a -> Code m (Maybe a) #

FromJSON a => FromJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

ToJSON a => ToJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Semigroup a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S."

Since 4.11.0: constraint on inner a value generalised from Monoid to Semigroup.

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

mempty :: Maybe a #

mappend :: Maybe a -> Maybe a -> Maybe a #

mconcat :: [Maybe a] -> Maybe a #

Semigroup a => Semigroup (Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(<>) :: Maybe a -> Maybe a -> Maybe a #

sconcat :: NonEmpty (Maybe a) -> Maybe a #

stimes :: Integral b => b -> Maybe a -> Maybe a #

Generic (Maybe a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Maybe a) :: Type -> Type #

Methods

from :: Maybe a -> Rep (Maybe a) x #

to :: Rep (Maybe a) x -> Maybe a #

SingKind a => SingKind (Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type DemoteRep (Maybe a)

Methods

fromSing :: forall (a0 :: Maybe a). Sing a0 -> DemoteRep (Maybe a)

Read a => Read (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Read

Show a => Show (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> Maybe a -> ShowS #

show :: Maybe a -> String #

showList :: [Maybe a] -> ShowS #

Default (Maybe a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Maybe a #

Eq a => Eq (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Maybe

Methods

(==) :: Maybe a -> Maybe a -> Bool #

(/=) :: Maybe a -> Maybe a -> Bool #

Ord a => Ord (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Maybe

Methods

compare :: Maybe a -> Maybe a -> Ordering #

(<) :: Maybe a -> Maybe a -> Bool #

(<=) :: Maybe a -> Maybe a -> Bool #

(>) :: Maybe a -> Maybe a -> Bool #

(>=) :: Maybe a -> Maybe a -> Bool #

max :: Maybe a -> Maybe a -> Maybe a #

min :: Maybe a -> Maybe a -> Maybe a #

Hashable a => Hashable (Maybe a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Maybe a -> Int #

hash :: Maybe a -> Int #

FromHttpApiData a => FromHttpApiData (Maybe a)
>>> parseUrlPiece "Just 123" :: Either Text (Maybe Int)
Right (Just 123)
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Maybe a)
>>> toUrlPiece (Just "Hello")
"just Hello"
Instance details

Defined in Web.Internal.HttpApiData

At (Maybe a) 
Instance details

Defined in Control.Lens.At

Methods

at :: Index (Maybe a) -> Lens' (Maybe a) (Maybe (IxValue (Maybe a))) #

Ixed (Maybe a) 
Instance details

Defined in Control.Lens.At

Methods

ix :: Index (Maybe a) -> Traversal' (Maybe a) (IxValue (Maybe a)) #

MonadIO m => ToPlugin (PluginFun m) 
Instance details

Defined in Mig.Core.Class.Plugin

AesonDefaultValue (Maybe a) 
Instance details

Defined in Data.OpenApi.Internal.AesonUtils

Methods

defaultValue :: Maybe (Maybe a) #

ToSchema a => ToSchema (Maybe a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

At (Maybe a) 
Instance details

Defined in Optics.At.Core

Methods

at :: Index (Maybe a) -> Lens' (Maybe a) (Maybe (IxValue (Maybe a))) #

Ixed (Maybe a) 
Instance details

Defined in Optics.At.Core

Associated Types

type IxKind (Maybe a) #

Methods

ix :: Index (Maybe a) -> Optic' (IxKind (Maybe a)) NoIx (Maybe a) (IxValue (Maybe a)) #

SingI ('Nothing :: Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing 'Nothing

SingI a2 => SingI ('Just a2 :: Maybe a1)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing ('Just a2)

ToSchema c => GToSchema (K1 i (Maybe c) :: Type -> Type) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(Selector s, ToSchema c) => GToSchema (S1 s (K1 i (Maybe c) :: Type -> Type))

Optional record fields.

Instance details

Defined in Data.OpenApi.Internal.Schema

type Rep1 Maybe

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep1 Maybe = D1 ('MetaData "Maybe" "GHC.Maybe" "base" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type DemoteRep (Maybe a) 
Instance details

Defined in GHC.Generics

type DemoteRep (Maybe a) = Maybe (DemoteRep a)
type Rep (Maybe a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep (Maybe a) = D1 ('MetaData "Maybe" "GHC.Maybe" "base" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
data Sing (b :: Maybe a) 
Instance details

Defined in GHC.Generics

data Sing (b :: Maybe a) where
type Code (Maybe a) 
Instance details

Defined in Generics.SOP.Instances

type Code (Maybe a) = '['[] :: [Type], '[a]]
type DatatypeInfoOf (Maybe a) 
Instance details

Defined in Generics.SOP.Instances

type DatatypeInfoOf (Maybe a) = 'ADT "GHC.Maybe" "Maybe" '['Constructor "Nothing", 'Constructor "Just"] '['[] :: [StrictnessInfo], '['StrictnessInfo 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy]]
type Index (Maybe a) 
Instance details

Defined in Control.Lens.At

type Index (Maybe a) = ()
type IxValue (Maybe a) 
Instance details

Defined in Control.Lens.At

type IxValue (Maybe a) = a
type Index (Maybe a) 
Instance details

Defined in Optics.At.Core

type Index (Maybe a) = ()
type IxKind (Maybe a) 
Instance details

Defined in Optics.At.Core

type IxValue (Maybe a) 
Instance details

Defined in Optics.At.Core

type IxValue (Maybe a) = a

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
FromJSON Text 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSONKey Text 
Instance details

Defined in Data.Aeson.Types.FromJSON

ToJSON Text 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSONKey Text 
Instance details

Defined in Data.Aeson.Types.ToJSON

Chunk Text 
Instance details

Defined in Data.Attoparsec.Internal.Types

Associated Types

type ChunkElem Text #

ToMarkup Text 
Instance details

Defined in Text.Blaze

ToValue Text 
Instance details

Defined in Text.Blaze

FoldCase Text 
Instance details

Defined in Data.CaseInsensitive.Internal

Methods

foldCase :: Text -> Text #

foldCaseList :: [Text] -> [Text]

Hashable Text 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

FromFormKey Text 
Instance details

Defined in Web.Internal.FormUrlEncoded

ToFormKey Text 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Text -> Text #

FromHttpApiData Text 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Text 
Instance details

Defined in Web.Internal.HttpApiData

Ixed Text 
Instance details

Defined in Control.Lens.At

ToText Text 
Instance details

Defined in Mig.Core.Types.Http

Methods

toText :: Text -> Text #

AesonDefaultValue Text 
Instance details

Defined in Data.OpenApi.Internal.AesonUtils

ToParamSchema Text 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToSchema Text 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToMediaType Text 
Instance details

Defined in Mig.Core.Class.MediaType

HasAuthorizationUrl OAuth2AuthorizationCodeFlow AuthorizationURL 
Instance details

Defined in Data.OpenApi.Lens

HasAuthorizationUrl OAuth2ImplicitFlow AuthorizationURL 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Response Text 
Instance details

Defined in Data.OpenApi.Lens

HasName License Text 
Instance details

Defined in Data.OpenApi.Lens

Methods

name :: Lens' License Text #

HasName Param Text 
Instance details

Defined in Data.OpenApi.Lens

Methods

name :: Lens' Param Text #

HasName Tag TagName 
Instance details

Defined in Data.OpenApi.Lens

Methods

name :: Lens' Tag TagName #

HasPropertyName Discriminator Text 
Instance details

Defined in Data.OpenApi.Lens

HasTitle Info Text 
Instance details

Defined in Data.OpenApi.Lens

Methods

title :: Lens' Info Text #

HasTokenUrl OAuth2AuthorizationCodeFlow TokenURL 
Instance details

Defined in Data.OpenApi.Lens

HasTokenUrl OAuth2ClientCredentialsFlow TokenURL 
Instance details

Defined in Data.OpenApi.Lens

HasTokenUrl OAuth2PasswordFlow TokenURL 
Instance details

Defined in Data.OpenApi.Lens

HasUrl Server Text 
Instance details

Defined in Data.OpenApi.Lens

Methods

url :: Lens' Server Text #

HasVersion Info Text 
Instance details

Defined in Data.OpenApi.Lens

Methods

version :: Lens' Info Text #

FromReqBody Text Text 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody Text Text 
Instance details

Defined in Mig.Core.Class.MediaType

ToRespBody Text Text 
Instance details

Defined in Mig.Core.Class.MediaType

HasCallbacks Components (Definitions Callback) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Example (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription ExternalDocs (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Header (Maybe HeaderName) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Info (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Link (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Operation (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Param (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription PathItem (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription RequestBody (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Schema (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription SecurityScheme (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Server (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasDescription Tag (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasEmail Contact (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasExamples Components (Definitions Example) 
Instance details

Defined in Data.OpenApi.Lens

HasFormat Schema (Maybe Format) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasFormat s (Maybe Format) 
Instance details

Defined in Data.OpenApi.Lens

Methods

format :: Lens' s (Maybe Format) #

HasHeaders Components (Definitions Header) 
Instance details

Defined in Data.OpenApi.Lens

HasLinks Components (Definitions Link) 
Instance details

Defined in Data.OpenApi.Lens

HasName Contact (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasName NamedSchema (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasName Xml (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

Methods

name :: Lens' Xml (Maybe Text) #

HasNamespace Xml (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasOperationId Link (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasOperationId Operation (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasOperationRef Link (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasParameters Components (Definitions Param) 
Instance details

Defined in Data.OpenApi.Lens

HasPattern Schema (Maybe Pattern) 
Instance details

Defined in Data.OpenApi.Lens

HasSchema s Schema => HasPattern s (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

Methods

pattern :: Lens' s (Maybe Text) #

HasPrefix Xml (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

Methods

prefix :: Lens' Xml (Maybe Text) #

HasRequestBodies Components (Definitions RequestBody) 
Instance details

Defined in Data.OpenApi.Lens

HasRequired Schema [ParamName] 
Instance details

Defined in Data.OpenApi.Lens

HasResponses Components (Definitions Response) 
Instance details

Defined in Data.OpenApi.Lens

HasSchemas Components (Definitions Schema) 
Instance details

Defined in Data.OpenApi.Lens

HasSummary Example (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasSummary Operation (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasSummary PathItem (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasTags Operation (InsOrdHashSet TagName) 
Instance details

Defined in Data.OpenApi.Lens

HasTermsOfService Info (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasTitle Schema (Maybe Text) 
Instance details

Defined in Data.OpenApi.Lens

HasCallbacks Operation (InsOrdHashMap Text (Referenced Callback)) 
Instance details

Defined in Data.OpenApi.Lens

HasEncoding MediaTypeObject (InsOrdHashMap Text Encoding) 
Instance details

Defined in Data.OpenApi.Lens

HasExamples Header (InsOrdHashMap Text (Referenced Example)) 
Instance details

Defined in Data.OpenApi.Lens

HasExamples MediaTypeObject (InsOrdHashMap Text (Referenced Example)) 
Instance details

Defined in Data.OpenApi.Lens

HasExamples Param (InsOrdHashMap Text (Referenced Example)) 
Instance details

Defined in Data.OpenApi.Lens

HasHeaders Encoding (InsOrdHashMap Text (Referenced Header)) 
Instance details

Defined in Data.OpenApi.Lens

HasHeaders Response (InsOrdHashMap HeaderName (Referenced Header)) 
Instance details

Defined in Data.OpenApi.Lens

HasLinks Response (InsOrdHashMap Text (Referenced Link)) 
Instance details

Defined in Data.OpenApi.Lens

HasMapping Discriminator (InsOrdHashMap Text Text) 
Instance details

Defined in Data.OpenApi.Lens

HasParameters Link (InsOrdHashMap Text ExpressionOrValue) 
Instance details

Defined in Data.OpenApi.Lens

HasProperties Schema (InsOrdHashMap Text (Referenced Schema)) 
Instance details

Defined in Data.OpenApi.Lens

HasVariables Server (InsOrdHashMap Text ServerVariable) 
Instance details

Defined in Data.OpenApi.Lens

HasServer (ReaderT env (ExceptT Text IO)) 
Instance details

Defined in Mig.Core.Class.Server

Associated Types

type ServerResult (ReaderT env (ExceptT Text IO)) #

type ChunkElem Text 
Instance details

Defined in Data.Attoparsec.Internal.Types

type State Text 
Instance details

Defined in Data.Attoparsec.Internal.Types

type State Text = Buffer
type Item Text 
Instance details

Defined in Data.Text

type Item Text = Char
type Index Text 
Instance details

Defined in Control.Lens.At

type Index Text = Int
type IxValue Text 
Instance details

Defined in Control.Lens.At

type Index Text 
Instance details

Defined in Optics.At

type Index Text = Int
type IxKind Text 
Instance details

Defined in Optics.At

type IxValue Text 
Instance details

Defined in Optics.At

type ServerResult (ReaderT env (ExceptT Text IO)) 
Instance details

Defined in Mig.Core.Class.Server

type ServerResult (ReaderT env (ExceptT Text IO)) = env -> Server IO

catMaybes :: [Maybe a] -> [a] #

The catMaybes function takes a list of Maybes and returns a list of all the Just values.

Examples

Expand

Basic usage:

>>> catMaybes [Just 1, Nothing, Just 3]
[1,3]

When constructing a list of Maybe values, catMaybes can be used to return all of the "success" results (if the list is the result of a map, then mapMaybe would be more appropriate):

>>> import Text.Read ( readMaybe )
>>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
[Just 1,Nothing,Just 3]
>>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ]
[1,3]

fromMaybe :: a -> Maybe a -> a #

The fromMaybe function takes a default value and a Maybe value. If the Maybe is Nothing, it returns the default value; otherwise, it returns the value contained in the Maybe.

Examples

Expand

Basic usage:

>>> fromMaybe "" (Just "Hello, World!")
"Hello, World!"
>>> fromMaybe "" Nothing
""

Read an integer from a string using readMaybe. If we fail to parse an integer, we want to return 0 by default:

>>> import Text.Read ( readMaybe )
>>> fromMaybe 0 (readMaybe "5")
5
>>> fromMaybe 0 (readMaybe "")
0

mapMaybe :: (a -> Maybe b) -> [a] -> [b] #

The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it is Just b, then b is included in the result list.

Examples

Expand

Using mapMaybe f x is a shortcut for catMaybes $ map f x in most cases:

>>> import Text.Read ( readMaybe )
>>> let readMaybeInt = readMaybe :: String -> Maybe Int
>>> mapMaybe readMaybeInt ["1", "Foo", "3"]
[1,3]
>>> catMaybes $ map readMaybeInt ["1", "Foo", "3"]
[1,3]

If we map the Just constructor, the entire list should be returned:

>>> mapMaybe Just [1,2,3]
[1,2,3]

class ToJSON a where #

A type that can be converted to JSON.

Instances in general must specify toJSON and should (but don't need to) specify toEncoding.

An example type and instance:

-- Allow ourselves to write Text literals.
{-# LANGUAGE OverloadedStrings #-}

data Coord = Coord { x :: Double, y :: Double }

instance ToJSON Coord where
  toJSON (Coord x y) = object ["x" .= x, "y" .= y]

  toEncoding (Coord x y) = pairs ("x" .= x <> "y" .= y)

Instead of manually writing your ToJSON instance, there are two options to do it automatically:

  • Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
  • The compiler can provide a default generic implementation for toJSON.

To use the second, simply add a deriving Generic clause to your datatype and declare a ToJSON instance. If you require nothing other than defaultOptions, it is sufficient to write (and this is the only alternative where the default toJSON implementation is sufficient):

{-# LANGUAGE DeriveGeneric #-}

import GHC.Generics

data Coord = Coord { x :: Double, y :: Double } deriving Generic

instance ToJSON Coord where
    toEncoding = genericToEncoding defaultOptions

or more conveniently using the DerivingVia extension

deriving via Generically Coord instance ToJSON Coord

If on the other hand you wish to customize the generic decoding, you have to implement both methods:

customOptions = defaultOptions
                { fieldLabelModifier = map toUpper
                }

instance ToJSON Coord where
    toJSON     = genericToJSON customOptions
    toEncoding = genericToEncoding customOptions

Previous versions of this library only had the toJSON method. Adding toEncoding had two reasons:

  1. toEncoding is more efficient for the common case that the output of toJSON is directly serialized to a ByteString. Further, expressing either method in terms of the other would be non-optimal.
  2. The choice of defaults allows a smooth transition for existing users: Existing instances that do not define toEncoding still compile and have the correct semantics. This is ensured by making the default implementation of toEncoding use toJSON. This produces correct results, but since it performs an intermediate conversion to a Value, it will be less efficient than directly emitting an Encoding. (this also means that specifying nothing more than instance ToJSON Coord would be sufficient as a generically decoding instance, but there probably exists no good reason to not specify toEncoding in new instances.)

Minimal complete definition

Nothing

Methods

toJSON :: a -> Value #

Convert a Haskell value to a JSON-friendly intermediate type.

toEncoding :: a -> Encoding #

Encode a Haskell value as JSON.

The default implementation of this method creates an intermediate Value using toJSON. This provides source-level compatibility for people upgrading from older versions of this library, but obviously offers no performance advantage.

To benefit from direct encoding, you must provide an implementation for this method. The easiest way to do so is by having your types implement Generic using the DeriveGeneric extension, and then have GHC generate a method body as follows.

instance ToJSON Coord where
    toEncoding = genericToEncoding defaultOptions

toJSONList :: [a] -> Value #

toEncodingList :: [a] -> Encoding #

omitField :: a -> Bool #

Defines when it is acceptable to omit a field of this type from a record. Used by (.?=) operator, and Generics and TH deriving with omitNothingFields = True.

Since: aeson-2.2.0.0

Instances

Instances details
ToJSON Key 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON DotNetTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Value 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Version 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Void 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON CTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Int16 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Int32 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Int64 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Int8 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Word16 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Word32 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Word64 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Word8 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON IntSet 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Ordering 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Url 
Instance details

Defined in Mig.Core.Class.Url

ToJSON Link Source # 
Instance details

Defined in Mig.Extra.Server.Html

ToJSON URI

Since: aeson-2.2.0.0

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON AdditionalProperties 
Instance details

Defined in Data.OpenApi.Internal

ToJSON ApiKeyLocation 
Instance details

Defined in Data.OpenApi.Internal

ToJSON ApiKeyParams 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Callback 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Components 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Contact 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Discriminator 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Encoding 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Example 
Instance details

Defined in Data.OpenApi.Internal

ToJSON ExpressionOrValue 
Instance details

Defined in Data.OpenApi.Internal

ToJSON ExternalDocs 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Header 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Info 
Instance details

Defined in Data.OpenApi.Internal

ToJSON License 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Link 
Instance details

Defined in Data.OpenApi.Internal

ToJSON MediaTypeObject 
Instance details

Defined in Data.OpenApi.Internal

ToJSON MimeList 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OAuth2AuthorizationCodeFlow 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OAuth2ClientCredentialsFlow 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OAuth2Flows 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OAuth2ImplicitFlow 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OAuth2PasswordFlow 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OpenApi 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OpenApiItems

As for nullary schema for 0-arity type constructors, see https://github.com/GetShopTV/swagger2/issues/167.

>>> BSL.putStrLn $ encodePretty (OpenApiItemsArray [])
{
    "example": [],
    "items": {},
    "maxItems": 0
}
Instance details

Defined in Data.OpenApi.Internal

ToJSON OpenApiSpecVersion 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OpenApiType 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Operation 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Param 
Instance details

Defined in Data.OpenApi.Internal

ToJSON ParamLocation 
Instance details

Defined in Data.OpenApi.Internal

ToJSON PathItem 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Reference 
Instance details

Defined in Data.OpenApi.Internal

ToJSON RequestBody 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Response 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Responses 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Schema 
Instance details

Defined in Data.OpenApi.Internal

ToJSON SecurityDefinitions 
Instance details

Defined in Data.OpenApi.Internal

ToJSON SecurityRequirement 
Instance details

Defined in Data.OpenApi.Internal

ToJSON SecurityScheme 
Instance details

Defined in Data.OpenApi.Internal

ToJSON SecuritySchemeType 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Server 
Instance details

Defined in Data.OpenApi.Internal

ToJSON ServerVariable 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Style 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Tag 
Instance details

Defined in Data.OpenApi.Internal

ToJSON URL 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Xml 
Instance details

Defined in Data.OpenApi.Internal

ToJSON Scientific 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Text 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Text 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON ShortText

Since: aeson-2.0.2.0

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON CalendarDiffDays 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Day 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Month 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Quarter 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON QuarterOfYear 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON DayOfWeek 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON DiffTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON NominalDiffTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON SystemTime

Encoded as number

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON UTCTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON CalendarDiffTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON LocalTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON TimeOfDay 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON ZonedTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON UUID 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Integer 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Natural 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON () 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: () -> Value #

toEncoding :: () -> Encoding #

toJSONList :: [()] -> Value #

toEncodingList :: [()] -> Encoding #

omitField :: () -> Bool #

ToJSON Bool 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Char 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Double 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Float 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Int 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON Word 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON v => ToJSON (KeyMap v) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Identity a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (First a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Last a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Down a)

Since: aeson-2.2.0.0

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (First a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Last a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Max a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Max a -> Value #

toEncoding :: Max a -> Encoding #

toJSONList :: [Max a] -> Value #

toEncodingList :: [Max a] -> Encoding #

omitField :: Max a -> Bool #

ToJSON a => ToJSON (Min a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Min a -> Value #

toEncoding :: Min a -> Encoding #

toJSONList :: [Min a] -> Value #

toEncodingList :: [Min a] -> Encoding #

omitField :: Min a -> Bool #

ToJSON a => ToJSON (WrappedMonoid a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Dual a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(ToJSON a, Integral a) => ToJSON (Ratio a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (IntMap a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Seq a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Seq a -> Value #

toEncoding :: Seq a -> Encoding #

toJSONList :: [Seq a] -> Value #

toEncodingList :: [Seq a] -> Encoding #

omitField :: Seq a -> Bool #

ToJSON a => ToJSON (Set a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Set a -> Value #

toEncoding :: Set a -> Encoding #

toJSONList :: [Set a] -> Value #

toEncodingList :: [Set a] -> Encoding #

omitField :: Set a -> Bool #

ToJSON v => ToJSON (Tree v) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON1 f => ToJSON (Fix f)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Fix f -> Value #

toEncoding :: Fix f -> Encoding #

toJSONList :: [Fix f] -> Value #

toEncodingList :: [Fix f] -> Encoding #

omitField :: Fix f -> Bool #

(ToJSON1 f, Functor f) => ToJSON (Mu f)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Mu f -> Value #

toEncoding :: Mu f -> Encoding #

toJSONList :: [Mu f] -> Value #

toEncodingList :: [Mu f] -> Encoding #

omitField :: Mu f -> Bool #

(ToJSON1 f, Functor f) => ToJSON (Nu f)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Nu f -> Value #

toEncoding :: Nu f -> Encoding #

toJSONList :: [Nu f] -> Value #

toEncodingList :: [Nu f] -> Encoding #

omitField :: Nu f -> Bool #

ToJSON a => ToJSON (DNonEmpty a)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (DList a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(Generic a, GToJSON' Value Zero (Rep a), GToJSON' Encoding Zero (Rep a)) => ToJSON (Generically a)

Since: aeson-2.1.0.0

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (InsOrdHashSet a) 
Instance details

Defined in Data.HashSet.InsOrd

(Eq p, ToJSON p, AesonDefaultValue p) => ToJSON (OAuth2Flow p) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Callback) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Example) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Header) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Link) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Param) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced RequestBody) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Response) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON (Referenced Schema) 
Instance details

Defined in Data.OpenApi.Internal

ToJSON a => ToJSON (Array a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(Prim a, ToJSON a) => ToJSON (PrimArray a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (SmallArray a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Maybe a)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (HashSet a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(Prim a, ToJSON a) => ToJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(Storable a, ToJSON a) => ToJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(Vector Vector a, ToJSON a) => ToJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (NonEmpty a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON a => ToJSON (a)

Since: aeson-2.0.2.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a) -> Value #

toEncoding :: (a) -> Encoding #

toJSONList :: [(a)] -> Value #

toEncodingList :: [(a)] -> Encoding #

omitField :: (a) -> Bool #

ToJSON a => ToJSON [a] 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: [a] -> Value #

toEncoding :: [a] -> Encoding #

toJSONList :: [[a]] -> Value #

toEncodingList :: [[a]] -> Encoding #

omitField :: [a] -> Bool #

(ToJSON a, ToJSON b) => ToJSON (Either a b) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Either a b -> Value #

toEncoding :: Either a b -> Encoding #

toJSONList :: [Either a b] -> Value #

toEncodingList :: [Either a b] -> Encoding #

omitField :: Either a b -> Bool #

HasResolution a => ToJSON (Fixed a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

ToJSON (Proxy a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(ToJSON v, ToJSONKey k) => ToJSON (Map k v) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Map k v -> Value #

toEncoding :: Map k v -> Encoding #

toJSONList :: [Map k v] -> Value #

toEncodingList :: [Map k v] -> Encoding #

omitField :: Map k v -> Bool #

(ToJSONKey k, ToJSON v) => ToJSON (InsOrdHashMap k v) 
Instance details

Defined in Data.HashMap.Strict.InsOrd

(ToJSON a, ToJSON b) => ToJSON (Either a b)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Either a b -> Value #

toEncoding :: Either a b -> Encoding #

toJSONList :: [Either a b] -> Value #

toEncodingList :: [Either a b] -> Encoding #

omitField :: Either a b -> Bool #

(ToJSON a, ToJSON b) => ToJSON (These a b)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: These a b -> Value #

toEncoding :: These a b -> Encoding #

toJSONList :: [These a b] -> Value #

toEncodingList :: [These a b] -> Encoding #

omitField :: These a b -> Bool #

(ToJSON a, ToJSON b) => ToJSON (Pair a b)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Pair a b -> Value #

toEncoding :: Pair a b -> Encoding #

toJSONList :: [Pair a b] -> Value #

toEncodingList :: [Pair a b] -> Encoding #

omitField :: Pair a b -> Bool #

(ToJSON a, ToJSON b) => ToJSON (These a b)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: These a b -> Value #

toEncoding :: These a b -> Encoding #

toJSONList :: [These a b] -> Value #

toEncodingList :: [These a b] -> Encoding #

omitField :: These a b -> Bool #

(ToJSON v, ToJSONKey k) => ToJSON (HashMap k v) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(ToJSON a, ToJSON b) => ToJSON (a, b) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b) -> Value #

toEncoding :: (a, b) -> Encoding #

toJSONList :: [(a, b)] -> Value #

toEncodingList :: [(a, b)] -> Encoding #

omitField :: (a, b) -> Bool #

ToJSON a => ToJSON (Const a b) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Const a b -> Value #

toEncoding :: Const a b -> Encoding #

toJSONList :: [Const a b] -> Value #

toEncodingList :: [Const a b] -> Encoding #

omitField :: Const a b -> Bool #

ToJSON b => ToJSON (Tagged a b) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Tagged a b -> Value #

toEncoding :: Tagged a b -> Encoding #

toJSONList :: [Tagged a b] -> Value #

toEncodingList :: [Tagged a b] -> Encoding #

omitField :: Tagged a b -> Bool #

(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (These1 f g a)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: These1 f g a -> Value #

toEncoding :: These1 f g a -> Encoding #

toJSONList :: [These1 f g a] -> Value #

toEncodingList :: [These1 f g a] -> Encoding #

omitField :: These1 f g a -> Bool #

(ToJSON a, ToJSON b, ToJSON c) => ToJSON (a, b, c) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c) -> Value #

toEncoding :: (a, b, c) -> Encoding #

toJSONList :: [(a, b, c)] -> Value #

toEncodingList :: [(a, b, c)] -> Encoding #

omitField :: (a, b, c) -> Bool #

(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (Product f g a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Product f g a -> Value #

toEncoding :: Product f g a -> Encoding #

toJSONList :: [Product f g a] -> Value #

toEncodingList :: [Product f g a] -> Encoding #

omitField :: Product f g a -> Bool #

(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (Sum f g a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Sum f g a -> Value #

toEncoding :: Sum f g a -> Encoding #

toJSONList :: [Sum f g a] -> Value #

toEncodingList :: [Sum f g a] -> Encoding #

omitField :: Sum f g a -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d) => ToJSON (a, b, c, d) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d) -> Value #

toEncoding :: (a, b, c, d) -> Encoding #

toJSONList :: [(a, b, c, d)] -> Value #

toEncodingList :: [(a, b, c, d)] -> Encoding #

omitField :: (a, b, c, d) -> Bool #

(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (Compose f g a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: Compose f g a -> Value #

toEncoding :: Compose f g a -> Encoding #

toJSONList :: [Compose f g a] -> Value #

toEncodingList :: [Compose f g a] -> Encoding #

omitField :: Compose f g a -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e) => ToJSON (a, b, c, d, e) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e) -> Value #

toEncoding :: (a, b, c, d, e) -> Encoding #

toJSONList :: [(a, b, c, d, e)] -> Value #

toEncodingList :: [(a, b, c, d, e)] -> Encoding #

omitField :: (a, b, c, d, e) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f) => ToJSON (a, b, c, d, e, f) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f) -> Value #

toEncoding :: (a, b, c, d, e, f) -> Encoding #

toJSONList :: [(a, b, c, d, e, f)] -> Value #

toEncodingList :: [(a, b, c, d, e, f)] -> Encoding #

omitField :: (a, b, c, d, e, f) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g) => ToJSON (a, b, c, d, e, f, g) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g) -> Value #

toEncoding :: (a, b, c, d, e, f, g) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g)] -> Encoding #

omitField :: (a, b, c, d, e, f, g) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h) => ToJSON (a, b, c, d, e, f, g, h) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i) => ToJSON (a, b, c, d, e, f, g, h, i) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j) => ToJSON (a, b, c, d, e, f, g, h, i, j) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k) => ToJSON (a, b, c, d, e, f, g, h, i, j, k) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l, m) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m, ToJSON n) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m, ToJSON n, ToJSON o) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool #

class FromJSON a where #

A type that can be converted from JSON, with the possibility of failure.

In many cases, you can get the compiler to generate parsing code for you (see below). To begin, let's cover writing an instance by hand.

There are various reasons a conversion could fail. For example, an Object could be missing a required key, an Array could be of the wrong size, or a value could be of an incompatible type.

The basic ways to signal a failed conversion are as follows:

  • fail yields a custom error message: it is the recommended way of reporting a failure;
  • empty (or mzero) is uninformative: use it when the error is meant to be caught by some (<|>);
  • typeMismatch can be used to report a failure when the encountered value is not of the expected JSON type; unexpected is an appropriate alternative when more than one type may be expected, or to keep the expected type implicit.

prependFailure (or modifyFailure) add more information to a parser's error messages.

An example type and instance using typeMismatch and prependFailure:

-- Allow ourselves to write Text literals.
{-# LANGUAGE OverloadedStrings #-}

data Coord = Coord { x :: Double, y :: Double }

instance FromJSON Coord where
    parseJSON (Object v) = Coord
        <$> v .: "x"
        <*> v .: "y"

    -- We do not expect a non-Object value here.
    -- We could use empty to fail, but typeMismatch
    -- gives a much more informative error message.
    parseJSON invalid    =
        prependFailure "parsing Coord failed, "
            (typeMismatch "Object" invalid)

For this common case of only being concerned with a single type of JSON value, the functions withObject, withScientific, etc. are provided. Their use is to be preferred when possible, since they are more terse. Using withObject, we can rewrite the above instance (assuming the same language extension and data type) as:

instance FromJSON Coord where
    parseJSON = withObject "Coord" $ \v -> Coord
        <$> v .: "x"
        <*> v .: "y"

Instead of manually writing your FromJSON instance, there are two options to do it automatically:

  • Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
  • The compiler can provide a default generic implementation for parseJSON.

To use the second, simply add a deriving Generic clause to your datatype and declare a FromJSON instance for your datatype without giving a definition for parseJSON.

For example, the previous example can be simplified to just:

{-# LANGUAGE DeriveGeneric #-}

import GHC.Generics

data Coord = Coord { x :: Double, y :: Double } deriving Generic

instance FromJSON Coord

or using the DerivingVia extension

deriving via Generically Coord instance FromJSON Coord

The default implementation will be equivalent to parseJSON = genericParseJSON defaultOptions; if you need different options, you can customize the generic decoding by defining:

customOptions = defaultOptions
                { fieldLabelModifier = map toUpper
                }

instance FromJSON Coord where
    parseJSON = genericParseJSON customOptions

Minimal complete definition

Nothing

Methods

parseJSON :: Value -> Parser a #

parseJSONList :: Value -> Parser [a] #

omittedField :: Maybe a #

Default value for optional fields. Used by (.:?=) operator, and Generics and TH deriving with allowOmittedFields = True (default).

Since: aeson-2.2.0.0

Instances

Instances details
FromJSON Key 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON DotNetTime 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Value 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Version 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Void 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON CTime 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Int16 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Int32 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Int64 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Int8 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Word16 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Word32 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Word64 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Word8 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON IntSet 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Ordering 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON URI

Since: aeson-2.2.0.0

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON AdditionalProperties 
Instance details

Defined in Data.OpenApi.Internal

FromJSON ApiKeyLocation 
Instance details

Defined in Data.OpenApi.Internal

FromJSON ApiKeyParams 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Callback 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Components 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Contact 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Discriminator 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Encoding 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Example 
Instance details

Defined in Data.OpenApi.Internal

FromJSON ExpressionOrValue

All strings are parsed as expressions

Instance details

Defined in Data.OpenApi.Internal

FromJSON ExternalDocs 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Header 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Info 
Instance details

Defined in Data.OpenApi.Internal

FromJSON License 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Link 
Instance details

Defined in Data.OpenApi.Internal

FromJSON MediaTypeObject 
Instance details

Defined in Data.OpenApi.Internal

FromJSON MimeList 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OAuth2AuthorizationCodeFlow 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OAuth2ClientCredentialsFlow 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OAuth2Flows 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OAuth2ImplicitFlow 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OAuth2PasswordFlow 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OpenApi 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OpenApiItems 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OpenApiSpecVersion 
Instance details

Defined in Data.OpenApi.Internal

FromJSON OpenApiType 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Operation 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Param 
Instance details

Defined in Data.OpenApi.Internal

FromJSON ParamLocation 
Instance details

Defined in Data.OpenApi.Internal

FromJSON PathItem 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Reference 
Instance details

Defined in Data.OpenApi.Internal

FromJSON RequestBody 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Response 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Responses 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Schema 
Instance details

Defined in Data.OpenApi.Internal

FromJSON SecurityDefinitions 
Instance details

Defined in Data.OpenApi.Internal

FromJSON SecurityRequirement 
Instance details

Defined in Data.OpenApi.Internal

FromJSON SecurityScheme 
Instance details

Defined in Data.OpenApi.Internal

FromJSON SecuritySchemeType 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Server 
Instance details

Defined in Data.OpenApi.Internal

FromJSON ServerVariable 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Style 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Tag 
Instance details

Defined in Data.OpenApi.Internal

FromJSON URL 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Xml 
Instance details

Defined in Data.OpenApi.Internal

FromJSON Scientific 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Text 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Text 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON ShortText

Since: aeson-2.0.2.0

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON CalendarDiffDays 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Day 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Month 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Quarter 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON QuarterOfYear 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON DayOfWeek 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON DiffTime

This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype Scientific and provide your own instance using withScientific if you want to allow larger inputs.

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON NominalDiffTime

This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype Scientific and provide your own instance using withScientific if you want to allow larger inputs.

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON SystemTime 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON UTCTime 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON CalendarDiffTime 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON LocalTime 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON TimeOfDay 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON ZonedTime

Supported string formats:

YYYY-MM-DD HH:MMZ YYYY-MM-DD HH:MM:SSZ YYYY-MM-DD HH:MM:SS.SSSZ

The first space may instead be a T, and the second space is optional. The Z represents UTC. The Z may be replaced with a time zone offset of the form +0000 or -08:00, where the first two digits are hours, the : is optional and the second two digits (also optional) are minutes.

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON UUID 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Integer

This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype Scientific and provide your own instance using withScientific if you want to allow larger inputs.

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Natural 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON () 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Bool 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Char 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Double 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Float 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Int 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON Word 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON v => FromJSON (KeyMap v)

Since: aeson-2.0.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Identity a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (First a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Last a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Down a)

Since: aeson-2.2.0.0

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (First a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Last a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Max a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Min a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (WrappedMonoid a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Dual a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON a, Integral a) => FromJSON (Ratio a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (IntMap a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Seq a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(Ord a, FromJSON a) => FromJSON (Set a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON v => FromJSON (Tree v) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON1 f => FromJSON (Fix f)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON1 f, Functor f) => FromJSON (Mu f)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON1 f, Functor f) => FromJSON (Nu f)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (DNonEmpty a)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (DList a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(Generic a, GFromJSON Zero (Rep a)) => FromJSON (Generically a)

Since: aeson-2.1.0.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(Eq a, Hashable a, FromJSON a) => FromJSON (InsOrdHashSet a) 
Instance details

Defined in Data.HashSet.InsOrd

(Eq p, FromJSON p, AesonDefaultValue p) => FromJSON (OAuth2Flow p) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Callback) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Example) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Header) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Link) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Param) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced RequestBody) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Response) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON (Referenced Schema) 
Instance details

Defined in Data.OpenApi.Internal

FromJSON a => FromJSON (Array a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(Prim a, FromJSON a) => FromJSON (PrimArray a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (SmallArray a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Maybe a)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(Eq a, Hashable a, FromJSON a) => FromJSON (HashSet a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(Prim a, FromJSON a) => FromJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(Storable a, FromJSON a) => FromJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(Vector Vector a, FromJSON a) => FromJSON (Vector a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (NonEmpty a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON a => FromJSON (a)

Since: aeson-2.0.2.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a) #

parseJSONList :: Value -> Parser [(a)] #

omittedField :: Maybe (a) #

FromJSON a => FromJSON [a] 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser [a] #

parseJSONList :: Value -> Parser [[a]] #

omittedField :: Maybe [a] #

(FromJSON a, FromJSON b) => FromJSON (Either a b) 
Instance details

Defined in Data.Aeson.Types.FromJSON

HasResolution a => FromJSON (Fixed a)

This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype Scientific and provide your own instance using withScientific if you want to allow larger inputs.

Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON (Proxy a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSONKey k, Ord k, FromJSON v) => FromJSON (Map k v) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (Map k v) #

parseJSONList :: Value -> Parser [Map k v] #

omittedField :: Maybe (Map k v) #

(Eq k, Hashable k, FromJSONKey k, FromJSON v) => FromJSON (InsOrdHashMap k v) 
Instance details

Defined in Data.HashMap.Strict.InsOrd

(FromJSON a, FromJSON b) => FromJSON (Either a b)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON a, FromJSON b) => FromJSON (These a b)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON a, FromJSON b) => FromJSON (Pair a b)

Since: aeson-1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (Pair a b) #

parseJSONList :: Value -> Parser [Pair a b] #

omittedField :: Maybe (Pair a b) #

(FromJSON a, FromJSON b) => FromJSON (These a b)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON v, FromJSONKey k, Eq k, Hashable k) => FromJSON (HashMap k v) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON a, FromJSON b) => FromJSON (a, b) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b) #

parseJSONList :: Value -> Parser [(a, b)] #

omittedField :: Maybe (a, b) #

FromJSON a => FromJSON (Const a b) 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSON b => FromJSON (Tagged a b) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (These1 f g a)

Since: aeson-1.5.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (These1 f g a) #

parseJSONList :: Value -> Parser [These1 f g a] #

omittedField :: Maybe (These1 f g a) #

(FromJSON a, FromJSON b, FromJSON c) => FromJSON (a, b, c) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c) #

parseJSONList :: Value -> Parser [(a, b, c)] #

omittedField :: Maybe (a, b, c) #

(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (Product f g a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (Product f g a) #

parseJSONList :: Value -> Parser [Product f g a] #

omittedField :: Maybe (Product f g a) #

(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (Sum f g a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (Sum f g a) #

parseJSONList :: Value -> Parser [Sum f g a] #

omittedField :: Maybe (Sum f g a) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d) => FromJSON (a, b, c, d) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d) #

parseJSONList :: Value -> Parser [(a, b, c, d)] #

omittedField :: Maybe (a, b, c, d) #

(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (Compose f g a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (Compose f g a) #

parseJSONList :: Value -> Parser [Compose f g a] #

omittedField :: Maybe (Compose f g a) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e) => FromJSON (a, b, c, d, e) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e) #

parseJSONList :: Value -> Parser [(a, b, c, d, e)] #

omittedField :: Maybe (a, b, c, d, e) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f) => FromJSON (a, b, c, d, e, f) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f)] #

omittedField :: Maybe (a, b, c, d, e, f) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g) => FromJSON (a, b, c, d, e, f, g) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g)] #

omittedField :: Maybe (a, b, c, d, e, f, g) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h) => FromJSON (a, b, c, d, e, f, g, h) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i) => FromJSON (a, b, c, d, e, f, g, h, i) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j) => FromJSON (a, b, c, d, e, f, g, h, i, j) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k) => FromJSON (a, b, c, d, e, f, g, h, i, j, k) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l, m) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m, FromJSON n) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m, FromJSON n, FromJSON o) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #

parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] #

omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #

class Monad m => MonadIO (m :: Type -> Type) where #

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Methods

liftIO :: IO a -> m a #

Lift a computation from the IO monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. IO is the base monad for the stack).

Example

Expand
import Control.Monad.Trans.State -- from the "transformers" library

printState :: Show s => StateT s IO ()
printState = do
  state <- get
  liftIO $ print state

Had we omitted liftIO, we would have ended up with this error:

• Couldn't match type ‘IO’ with ‘StateT s IO’
 Expected type: StateT s IO ()
   Actual type: IO ()

The important part here is the mismatch between StateT s IO () and IO ().

Luckily, we know of a function that takes an IO a and returns an (m a): liftIO, enabling us to run the program and see the expected results:

> evalStateT printState "hello"
"hello"

> evalStateT printState 3
3

Instances

Instances details
MonadIO IO

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.IO.Class

Methods

liftIO :: IO a -> IO a #

MonadIO Client 
Instance details

Defined in Mig.Client

Methods

liftIO :: IO a -> Client a #

MonadIO Client' 
Instance details

Defined in Mig.Client

Methods

liftIO :: IO a -> Client' a #

MonadIO Q 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftIO :: IO a -> Q a #

MonadIO m => MonadIO (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftIO :: IO a -> ResourceT m a #

(Functor f, MonadIO m) => MonadIO (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftIO :: IO a -> FreeT f m a #

(Error e, MonadIO m) => MonadIO (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

liftIO :: IO a -> ErrorT e m a #

MonadIO m => MonadIO (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

liftIO :: IO a -> ReaderT r m a #

MonadIO m => MonadIO (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftIO :: IO a -> ConduitT i o m a #

MonadIO m => MonadIO (Send method m) 
Instance details

Defined in Mig.Core.Types.Route

Methods

liftIO :: IO a -> Send method m a #

MonadIO m => MonadIO (Pipe l i o u m) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

liftIO :: IO a -> Pipe l i o u m a #

words :: String -> [String] #

words breaks a string up into a list of words, which were delimited by white space.

>>> words "Lorem ipsum\ndolor"
["Lorem","ipsum","dolor"]

unwords :: [String] -> String #

unwords is an inverse operation to words. It joins words with separating spaces.

>>> unwords ["Lorem", "ipsum", "dolor"]
"Lorem ipsum dolor"

unlines :: [String] -> String #

unlines is an inverse operation to lines. It joins lines, after appending a terminating newline to each.

>>> unlines ["Hello", "World", "!"]
"Hello\nWorld\n!\n"

lines :: String -> [String] #

lines breaks a string up into a list of strings at newline characters. The resulting strings do not contain newlines.

Note that after splitting the string at newline characters, the last part of the string is considered a line even if it doesn't end with a newline. For example,

>>> lines ""
[]
>>> lines "\n"
[""]
>>> lines "one"
["one"]
>>> lines "one\n"
["one"]
>>> lines "one\n\n"
["one",""]
>>> lines "one\ntwo"
["one","two"]
>>> lines "one\ntwo\n"
["one","two"]

Thus lines s contains at least as many elements as newlines in s.

maybeToList :: Maybe a -> [a] #

The maybeToList function returns an empty list when given Nothing or a singleton list when given Just.

Examples

Expand

Basic usage:

>>> maybeToList (Just 7)
[7]
>>> maybeToList Nothing
[]

One can use maybeToList to avoid pattern matching when combined with a function that (safely) works on lists:

>>> import Text.Read ( readMaybe )
>>> sum $ maybeToList (readMaybe "3")
3
>>> sum $ maybeToList (readMaybe "")
0

maybe :: b -> (a -> b) -> Maybe a -> b #

The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result.

Examples

Expand

Basic usage:

>>> maybe False odd (Just 3)
True
>>> maybe False odd Nothing
False

Read an integer from a string using readMaybe. If we succeed, return twice the integer; that is, apply (*2) to it. If instead we fail to parse an integer, return 0 by default:

>>> import Text.Read ( readMaybe )
>>> maybe 0 (*2) (readMaybe "5")
10
>>> maybe 0 (*2) (readMaybe "")
0

Apply show to a Maybe Int. If we have Just n, we want to show the underlying Int n. But if we have Nothing, we return the empty string instead of (for example) "Nothing":

>>> maybe "" show (Just 5)
"5"
>>> maybe "" show Nothing
""

listToMaybe :: [a] -> Maybe a #

The listToMaybe function returns Nothing on an empty list or Just a where a is the first element of the list.

Examples

Expand

Basic usage:

>>> listToMaybe []
Nothing
>>> listToMaybe [9]
Just 9
>>> listToMaybe [1,2,3]
Just 1

Composing maybeToList with listToMaybe should be the identity on singleton/empty lists:

>>> maybeToList $ listToMaybe [5]
[5]
>>> maybeToList $ listToMaybe []
[]

But not on lists with more than one element:

>>> maybeToList $ listToMaybe [1,2,3]
[1]

isNothing :: Maybe a -> Bool #

The isNothing function returns True iff its argument is Nothing.

Examples

Expand

Basic usage:

>>> isNothing (Just 3)
False
>>> isNothing (Just ())
False
>>> isNothing Nothing
True

Only the outer constructor is taken into consideration:

>>> isNothing (Just Nothing)
False

isJust :: Maybe a -> Bool #

The isJust function returns True iff its argument is of the form Just _.

Examples

Expand

Basic usage:

>>> isJust (Just 3)
True
>>> isJust (Just ())
True
>>> isJust Nothing
False

Only the outer constructor is taken into consideration:

>>> isJust (Just Nothing)
True

fromJust :: HasCallStack => Maybe a -> a #

The fromJust function extracts the element out of a Just and throws an error if its argument is Nothing.

Examples

Expand

Basic usage:

>>> fromJust (Just 1)
1
>>> 2 * (fromJust (Just 10))
20
>>> 2 * (fromJust Nothing)
*** Exception: Maybe.fromJust: Nothing
...

class ToMarkup a where #

Class allowing us to use a single function for Markup values

Minimal complete definition

toMarkup

Methods

toMarkup :: a -> Markup #

Convert a value to Markup.

preEscapedToMarkup :: a -> Markup #

Convert a value to Markup without escaping

Instances

Instances details
ToMarkup Int32 
Instance details

Defined in Text.Blaze

ToMarkup Int64 
Instance details

Defined in Text.Blaze

ToMarkup Word32 
Instance details

Defined in Text.Blaze

ToMarkup Word64 
Instance details

Defined in Text.Blaze

ToMarkup Markup 
Instance details

Defined in Text.Blaze

ToMarkup Link Source # 
Instance details

Defined in Mig.Extra.Server.Html

ToMarkup Text 
Instance details

Defined in Text.Blaze

ToMarkup Builder 
Instance details

Defined in Text.Blaze

ToMarkup Text 
Instance details

Defined in Text.Blaze

ToMarkup String 
Instance details

Defined in Text.Blaze

ToMarkup Integer 
Instance details

Defined in Text.Blaze

ToMarkup Natural 
Instance details

Defined in Text.Blaze

ToMarkup Bool 
Instance details

Defined in Text.Blaze

ToMarkup Char 
Instance details

Defined in Text.Blaze

ToMarkup Double 
Instance details

Defined in Text.Blaze

ToMarkup Float 
Instance details

Defined in Text.Blaze

ToMarkup Int 
Instance details

Defined in Text.Blaze

ToMarkup Word 
Instance details

Defined in Text.Blaze

ToMarkup (NonEmpty Char) 
Instance details

Defined in Text.Blaze

ToMarkup [Markup] 
Instance details

Defined in Text.Blaze

type Html = Markup #

class MonadTrans (t :: (Type -> Type) -> Type -> Type) where #

The class of monad transformers. Instances should satisfy the following laws, which state that lift is a monad transformation:

Methods

lift :: Monad m => m a -> t m a #

Lift a computation from the argument monad to the constructed monad.

Instances

Instances details
MonadTrans Free

This is not a true monad transformer. It is only a monad transformer "up to retract".

Instance details

Defined in Control.Monad.Free

Methods

lift :: Monad m => m a -> Free m a #

MonadTrans Yoneda 
Instance details

Defined in Data.Functor.Yoneda

Methods

lift :: Monad m => m a -> Yoneda m a #

MonadTrans ResourceT 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

lift :: Monad m => m a -> ResourceT m a #

Alternative f => MonadTrans (CofreeT f) 
Instance details

Defined in Control.Comonad.Trans.Cofree

Methods

lift :: Monad m => m a -> CofreeT f m a #

Functor f => MonadTrans (FreeT f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

lift :: Monad m => m a -> FreeT f m a #

MonadTrans (ErrorT e) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

lift :: Monad m => m a -> ErrorT e m a #

MonadTrans (ReaderT r) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

lift :: Monad m => m a -> ReaderT r m a #

MonadTrans (ConduitT i o) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

lift :: Monad m => m a -> ConduitT i o m a #

MonadTrans (Send method :: (Type -> Type) -> Type -> Type) 
Instance details

Defined in Mig.Core.Types.Route

Methods

lift :: Monad m => m a -> Send method m a #

MonadTrans (Pipe l i o u) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

lift :: Monad m => m a -> Pipe l i o u m a #

class Default a where #

A class for types with a default value.

Minimal complete definition

Nothing

Methods

def :: a #

The default value for this type.

Instances

Instances details
Default All 
Instance details

Defined in Data.Default.Class

Methods

def :: All #

Default Any 
Instance details

Defined in Data.Default.Class

Methods

def :: Any #

Default CClock 
Instance details

Defined in Data.Default.Class

Methods

def :: CClock #

Default CDouble 
Instance details

Defined in Data.Default.Class

Methods

def :: CDouble #

Default CFloat 
Instance details

Defined in Data.Default.Class

Methods

def :: CFloat #

Default CInt 
Instance details

Defined in Data.Default.Class

Methods

def :: CInt #

Default CIntMax 
Instance details

Defined in Data.Default.Class

Methods

def :: CIntMax #

Default CIntPtr 
Instance details

Defined in Data.Default.Class

Methods

def :: CIntPtr #

Default CLLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CLLong #

Default CLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CLong #

Default CPtrdiff 
Instance details

Defined in Data.Default.Class

Methods

def :: CPtrdiff #

Default CSUSeconds 
Instance details

Defined in Data.Default.Class

Methods

def :: CSUSeconds #

Default CShort 
Instance details

Defined in Data.Default.Class

Methods

def :: CShort #

Default CSigAtomic 
Instance details

Defined in Data.Default.Class

Methods

def :: CSigAtomic #

Default CSize 
Instance details

Defined in Data.Default.Class

Methods

def :: CSize #

Default CTime 
Instance details

Defined in Data.Default.Class

Methods

def :: CTime #

Default CUInt 
Instance details

Defined in Data.Default.Class

Methods

def :: CUInt #

Default CUIntMax 
Instance details

Defined in Data.Default.Class

Methods

def :: CUIntMax #

Default CUIntPtr 
Instance details

Defined in Data.Default.Class

Methods

def :: CUIntPtr #

Default CULLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CULLong #

Default CULong 
Instance details

Defined in Data.Default.Class

Methods

def :: CULong #

Default CUSeconds 
Instance details

Defined in Data.Default.Class

Methods

def :: CUSeconds #

Default CUShort 
Instance details

Defined in Data.Default.Class

Methods

def :: CUShort #

Default Int16 
Instance details

Defined in Data.Default.Class

Methods

def :: Int16 #

Default Int32 
Instance details

Defined in Data.Default.Class

Methods

def :: Int32 #

Default Int64 
Instance details

Defined in Data.Default.Class

Methods

def :: Int64 #

Default Int8 
Instance details

Defined in Data.Default.Class

Methods

def :: Int8 #

Default Word16 
Instance details

Defined in Data.Default.Class

Methods

def :: Word16 #

Default Word32 
Instance details

Defined in Data.Default.Class

Methods

def :: Word32 #

Default Word64 
Instance details

Defined in Data.Default.Class

Methods

def :: Word64 #

Default Word8 
Instance details

Defined in Data.Default.Class

Methods

def :: Word8 #

Default Ordering 
Instance details

Defined in Data.Default.Class

Methods

def :: Ordering #

Default Integer 
Instance details

Defined in Data.Default.Class

Methods

def :: Integer #

Default () 
Instance details

Defined in Data.Default.Class

Methods

def :: () #

Default Double 
Instance details

Defined in Data.Default.Class

Methods

def :: Double #

Default Float 
Instance details

Defined in Data.Default.Class

Methods

def :: Float #

Default Int 
Instance details

Defined in Data.Default.Class

Methods

def :: Int #

Default Word 
Instance details

Defined in Data.Default.Class

Methods

def :: Word #

(Default a, RealFloat a) => Default (Complex a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Complex a #

Default (First a) 
Instance details

Defined in Data.Default.Class

Methods

def :: First a #

Default (Last a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Last a #

Default a => Default (Dual a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Dual a #

Default (Endo a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Endo a #

Num a => Default (Product a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Product a #

Num a => Default (Sum a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Sum a #

Integral a => Default (Ratio a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Ratio a #

Default a => Default (IO a) 
Instance details

Defined in Data.Default.Class

Methods

def :: IO a #

Default (Maybe a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Maybe a #

Default [a] 
Instance details

Defined in Data.Default.Class

Methods

def :: [a] #

Default r => Default (e -> r) 
Instance details

Defined in Data.Default.Class

Methods

def :: e -> r #

(Default a, Default b) => Default (a, b) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b) #

(Default a, Default b, Default c) => Default (a, b, c) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c) #

(Default a, Default b, Default c, Default d) => Default (a, b, c, d) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d) #

(Default a, Default b, Default c, Default d, Default e) => Default (a, b, c, d, e) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e) #

(Default a, Default b, Default c, Default d, Default e, Default f) => Default (a, b, c, d, e, f) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e, f) #

(Default a, Default b, Default c, Default d, Default e, Default f, Default g) => Default (a, b, c, d, e, f, g) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e, f, g) #

parseUnique :: FromHttpApiData v => Text -> Form -> Either Text v #

Lookup a unique value for a given key and parse it with parseQueryParam. Fail if there is zero or more than one value for the key.

>>> parseUnique "age" [] :: Either Text Word8
Left "Could not find key \"age\""
>>> parseUnique "age" [("age", "12"), ("age", "25")] :: Either Text Word8
Left "Duplicate key \"age\""
>>> parseUnique "age" [("age", "seven")] :: Either Text Word8
Left "could not parse: `seven' (input does not start with a digit)"
>>> parseUnique "age" [("age", "777")] :: Either Text Word8
Left "out of bounds: `777' (should be between 0 and 255)"
>>> parseUnique "age" [("age", "7")] :: Either Text Word8
Right 7

parseMaybe :: FromHttpApiData v => Text -> Form -> Either Text (Maybe v) #

Lookup an optional value for a given key and parse it with parseQueryParam. Fail if there is more than one value for the key.

>>> parseMaybe "age" [] :: Either Text (Maybe Word8)
Right Nothing
>>> parseMaybe "age" [("age", "12"), ("age", "25")] :: Either Text (Maybe Word8)
Left "Duplicate key \"age\""
>>> parseMaybe "age" [("age", "seven")] :: Either Text (Maybe Word8)
Left "could not parse: `seven' (input does not start with a digit)"
>>> parseMaybe "age" [("age", "777")] :: Either Text (Maybe Word8)
Left "out of bounds: `777' (should be between 0 and 255)"
>>> parseMaybe "age" [("age", "7")] :: Either Text (Maybe Word8)
Right (Just 7)

parseAll :: FromHttpApiData v => Text -> Form -> Either Text [v] #

Lookup all values for a given key in a Form and parse them with parseQueryParams.

>>> parseAll "age" [] :: Either Text [Word8]
Right []
>>> parseAll "age" [("age", "8"), ("age", "seven")] :: Either Text [Word8]
Left "could not parse: `seven' (input does not start with a digit)"
>>> parseAll "age" [("age", "8"), ("age", "777")] :: Either Text [Word8]
Left "out of bounds: `777' (should be between 0 and 255)"
>>> parseAll "age" [("age", "12"), ("age", "25")] :: Either Text [Word8]
Right [12,25]

lookupUnique :: Text -> Form -> Either Text Text #

Lookup a unique value for a key. Fail if there is zero or more than one value.

>>> lookupUnique "name" []
Left "Could not find key \"name\""
>>> lookupUnique "name" [("name", "Oleg")]
Right "Oleg"
>>> lookupUnique "name" [("name", "Oleg"), ("name", "David")]
Left "Duplicate key \"name\""

lookupMaybe :: Text -> Form -> Either Text (Maybe Text) #

Lookup an optional value for a key. Fail if there is more than one value.

>>> lookupMaybe "name" []
Right Nothing
>>> lookupMaybe "name" [("name", "Oleg")]
Right (Just "Oleg")
>>> lookupMaybe "name" [("name", "Oleg"), ("name", "David")]
Left "Duplicate key \"name\""

lookupAll :: Text -> Form -> [Text] #

Find all values corresponding to a given key in a Form.

>>> lookupAll "name" []
[]
>>> lookupAll "name" [("name", "Oleg")]
["Oleg"]
>>> lookupAll "name" [("name", "Oleg"), ("name", "David")]
["Oleg","David"]

urlEncodeAsFormStable :: ToForm a => a -> ByteString #

This is a convenience function for encoding a datatype that has instance of ToForm directly to a application/x-www-form-urlencoded ByteString.

This is effectively urlEncodeFormStable . toForm.

>>> urlEncodeAsFormStable Person {name = "Dennis", age = 22}
"age=22&name=Dennis"

urlEncodeAsForm :: ToForm a => a -> ByteString #

This is a convenience function for encoding a datatype that has instance of ToForm directly to a application/x-www-form-urlencoded ByteString.

This is effectively urlEncodeForm . toForm.

_NOTE:_ this encoding is unstable and may result in different key order (but not values). For a stable encoding see urlEncodeAsFormStable.

urlDecodeAsForm :: FromForm a => ByteString -> Either Text a #

This is a convenience function for decoding a application/x-www-form-urlencoded ByteString directly to a datatype that has an instance of FromForm.

This is effectively fromForm <=< urlDecodeForm.

>>> urlDecodeAsForm "name=Dennis&age=22" :: Either Text Person
Right (Person {name = "Dennis", age = 22})

urlDecodeParams :: ByteString -> Either Text [(Text, Text)] #

Decode an application/x-www-form-urlencoded ByteString to a list of key-value pairs.

See also urlDecodeForm.

urlDecodeForm :: ByteString -> Either Text Form #

Decode an application/x-www-form-urlencoded ByteString to a Form.

Key-value pairs get decoded normally:

>>> urlDecodeForm "name=Greg&lastname=Weber"
Right (fromList [("lastname","Weber"),("name","Greg")])

Keys with no values get decoded to pairs with empty values.

>>> urlDecodeForm "is_test"
Right (fromList [("is_test","")])

Empty keys are allowed:

>>> urlDecodeForm "=foobar"
Right (fromList [("","foobar")])

The empty string gets decoded into an empty Form:

>>> urlDecodeForm ""
Right (fromList [])

Everything is un-escaped with unEscapeString:

>>> urlDecodeForm "fullname=Andres%20L%C3%B6h"
Right (fromList [("fullname","Andres L\246h")])

Improperly formed strings result in an error:

>>> urlDecodeForm "this=has=too=many=equals"
Left "not a valid pair: this=has=too=many=equals"

urlEncodeParams :: [(Text, Text)] -> ByteString #

Encode a list of key-value pairs to an application/x-www-form-urlencoded ByteString.

See also urlEncodeFormStable.

urlEncodeFormStable :: Form -> ByteString #

Encode a Form to an application/x-www-form-urlencoded ByteString.

For an unstable (but faster) encoding see urlEncodeForm.

Key-value pairs get encoded to key=value and separated by &:

>>> urlEncodeFormStable [("name", "Julian"), ("lastname", "Arni")]
"lastname=Arni&name=Julian"

Keys with empty values get encoded to just key (without the = sign):

>>> urlEncodeFormStable [("is_test", "")]
"is_test"

Empty keys are allowed too:

>>> urlEncodeFormStable [("", "foobar")]
"=foobar"

However, if both key and value are empty, the key-value pair is ignored. (This prevents urlDecodeForm . urlEncodeFormStable from being a true isomorphism).

>>> urlEncodeFormStable [("", "")]
""

Everything is escaped with escapeURIString isUnreserved:

>>> urlEncodeFormStable [("fullname", "Andres Löh")]
"fullname=Andres%20L%C3%B6h"

urlEncodeForm :: Form -> ByteString #

Encode a Form to an application/x-www-form-urlencoded ByteString.

_NOTE:_ this encoding is unstable and may result in different key order (but not values). For a stable encoding see urlEncodeFormStable.

genericFromForm :: (Generic a, GFromForm a (Rep a)) => FormOptions -> Form -> Either Text a #

A Generic-based implementation of fromForm. This is used as a default implementation in FromForm.

Note that this only works for records (i.e. product data types with named fields):

data Person = Person
  { name :: String
  , age  :: Int
  } deriving (Generic)

In this implementation each field's value gets decoded using parseQueryParam. Two field types are exceptions:

  • for values of type Maybe a an entry is parsed if present in the Form and the is decoded with parseQueryParam; if no entry is present result is Nothing;
  • for values of type [a] (except [Char]) all entries are parsed to produce a list of parsed values;

Here's an example:

data Post = Post
  { title    :: String
  , subtitle :: Maybe String
  , comments :: [String]
  } deriving (Generic, Show)

instance FromForm Post
>>> urlDecodeAsForm "comments=Nice%20post%21&comments=%2B1&title=Test" :: Either Text Post
Right (Post {title = "Test", subtitle = Nothing, comments = ["Nice post!","+1"]})

toEntriesByKeyStable :: (Ord k, FromFormKey k, FromHttpApiData v) => Form -> Either Text [(k, [v])] #

Parse a Form into a list of entries groupped by key.

>>> toEntriesByKeyStable [("name", "Nick"), ("color", "red"), ("color", "white")] :: Either Text [(Text, [Text])]
Right [("color",["red","white"]),("name",["Nick"])]

For an unstable (but faster) conversion see toEntriesByKey.

toEntriesByKey :: (FromFormKey k, FromHttpApiData v) => Form -> Either Text [(k, [v])] #

Parse a Form into a list of entries groupped by key.

_NOTE:_ this conversion is unstable and may result in different key order (but not values). For a stable encoding see toEntriesByKeyStable.

genericToForm :: (Generic a, GToForm a (Rep a)) => FormOptions -> a -> Form #

A Generic-based implementation of toForm. This is used as a default implementation in ToForm.

Note that this only works for records (i.e. product data types with named fields):

data Person = Person
  { name :: String
  , age  :: Int
  } deriving (Generic)

In this implementation each field's value gets encoded using toQueryParam. Two field types are exceptions:

  • for values of type Maybe a an entry is added to the Form only when it is Just x and the encoded value is toQueryParam x; Nothing values are omitted from the Form;
  • for values of type [a] (except [Char]) an entry is added for every item in the list; if the list is empty no entries are added to the Form;

Here's an example:

data Post = Post
  { title    :: String
  , subtitle :: Maybe String
  , comments :: [String]
  } deriving (Generic, Show)

instance ToForm Post
>>> urlEncodeAsFormStable Post { title = "Test", subtitle = Nothing, comments = ["Nice post!", "+1"] }
"comments=Nice%20post%21&comments=%2B1&title=Test"

fromEntriesByKey :: (ToFormKey k, ToHttpApiData v) => [(k, [v])] -> Form #

Convert a list of entries groupped by key into a Form.

>>> fromEntriesByKey [("name",["Nick"]),("color",["red","blue"])]
fromList [("color","red"),("color","blue"),("name","Nick")]

toListStable :: Form -> [(Text, Text)] #

A stable version of toList.

class ToFormKey k where #

Typeclass for types that can be used as keys in a Form-like container (like Map).

Methods

toFormKey :: k -> Text #

Render a key for a Form.

Instances

Instances details
ToFormKey All 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: All -> Text #

ToFormKey Any 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Any -> Text #

ToFormKey Void 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Void -> Text #

ToFormKey Int16 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Int16 -> Text #

ToFormKey Int32 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Int32 -> Text #

ToFormKey Int64 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Int64 -> Text #

ToFormKey Int8 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Int8 -> Text #

ToFormKey Word16 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Word16 -> Text #

ToFormKey Word32 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Word32 -> Text #

ToFormKey Word64 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Word64 -> Text #

ToFormKey Word8 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Word8 -> Text #

ToFormKey Ordering 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Ordering -> Text #

ToFormKey Text 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Text -> Text #

ToFormKey Text 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Text -> Text0 #

ToFormKey Day 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Day -> Text #

ToFormKey Month 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Month -> Text #

ToFormKey Quarter 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Quarter -> Text #

ToFormKey QuarterOfYear 
Instance details

Defined in Web.Internal.FormUrlEncoded

ToFormKey NominalDiffTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

ToFormKey UTCTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: UTCTime -> Text #

ToFormKey LocalTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: LocalTime -> Text #

ToFormKey ZonedTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: ZonedTime -> Text #

ToFormKey String 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: String -> Text #

ToFormKey Integer 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Integer -> Text #

ToFormKey Natural 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Natural -> Text #

ToFormKey () 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: () -> Text #

ToFormKey Bool 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Bool -> Text #

ToFormKey Char 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Char -> Text #

ToFormKey Double 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Double -> Text #

ToFormKey Float 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Float -> Text #

ToFormKey Int 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Int -> Text #

ToFormKey Word 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Word -> Text #

ToFormKey a => ToFormKey (Identity a)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Identity a -> Text #

ToFormKey a => ToFormKey (First a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: First a -> Text #

ToFormKey a => ToFormKey (Last a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Last a -> Text #

ToFormKey a => ToFormKey (Max a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Max a -> Text #

ToFormKey a => ToFormKey (Min a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Min a -> Text #

ToFormKey a => ToFormKey (Dual a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Dual a -> Text #

ToFormKey a => ToFormKey (Product a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Product a -> Text #

ToFormKey a => ToFormKey (Sum a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Sum a -> Text #

ToFormKey a => ToFormKey (Const a b)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Const a b -> Text #

ToFormKey a => ToFormKey (Tagged b a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toFormKey :: Tagged b a -> Text #

class FromFormKey k where #

Typeclass for types that can be parsed from keys of a Form. This is the reverse of ToFormKey.

Methods

parseFormKey :: Text -> Either Text k #

Parse a key of a Form.

Instances

Instances details
FromFormKey All 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Any 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Void 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Int16 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Int32 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Int64 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Int8 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Word16 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Word32 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Word64 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Word8 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Ordering 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Text 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Text 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Day 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Month 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Quarter 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey QuarterOfYear 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey NominalDiffTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey UTCTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey LocalTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey ZonedTime 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey String 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Integer 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Natural 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey () 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text () #

FromFormKey Bool 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Char 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Double 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Float 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Int 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey Word 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey a => FromFormKey (Identity a)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey a => FromFormKey (First a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (First a) #

FromFormKey a => FromFormKey (Last a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Last a) #

FromFormKey a => FromFormKey (Max a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Max a) #

FromFormKey a => FromFormKey (Min a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Min a) #

FromFormKey a => FromFormKey (Dual a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Dual a) #

FromFormKey a => FromFormKey (Product a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

FromFormKey a => FromFormKey (Sum a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Sum a) #

FromFormKey a => FromFormKey (Const a b)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Const a b) #

FromFormKey a => FromFormKey (Tagged b a) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

parseFormKey :: Text -> Either Text (Tagged b a) #

newtype Form #

The contents of a form, not yet URL-encoded.

Form can be URL-encoded with urlEncodeForm and URL-decoded with urlDecodeForm.

Constructors

Form 

Fields

Instances

Instances details
Monoid Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

mempty :: Form #

mappend :: Form -> Form -> Form #

mconcat :: [Form] -> Form #

Semigroup Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

(<>) :: Form -> Form -> Form #

sconcat :: NonEmpty Form -> Form #

stimes :: Integral b => b -> Form -> Form #

IsList Form

_NOTE:_ toList is unstable and may result in different key order (but not values). For a stable conversion use toListStable.

Instance details

Defined in Web.Internal.FormUrlEncoded

Associated Types

type Item Form #

Methods

fromList :: [Item Form] -> Form #

fromListN :: Int -> [Item Form] -> Form #

toList :: Form -> [Item Form] #

Generic Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Associated Types

type Rep Form :: Type -> Type #

Methods

from :: Form -> Rep Form x #

to :: Rep Form x -> Form #

Read Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Show Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

showsPrec :: Int -> Form -> ShowS #

show :: Form -> String #

showList :: [Form] -> ShowS #

Eq Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

(==) :: Form -> Form -> Bool #

(/=) :: Form -> Form -> Bool #

FromForm Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

fromForm :: Form -> Either Text Form #

ToForm Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toForm :: Form -> Form #

type Item Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

type Item Form = (Text, Text)
type Rep Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

type Rep Form = D1 ('MetaData "Form" "Web.Internal.FormUrlEncoded" "http-api-data-0.6-CXt5Hc7Hro77WasNz0yRlY" 'True) (C1 ('MetaCons "Form" 'PrefixI 'True) (S1 ('MetaSel ('Just "unForm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap Text [Text]))))

class ToForm a where #

Convert a value into Form.

An example type and instance:

{-# LANGUAGE OverloadedLists #-}

data Person = Person
  { name :: String
  , age  :: Int }

instance ToForm Person where
  toForm person =
    [ ("name", toQueryParam (name person))
    , ("age", toQueryParam (age person)) ]

Instead of manually writing ToForm instances you can use a default generic implementation of toForm.

To do that, simply add deriving Generic clause to your datatype and declare a ToForm instance for your datatype without giving definition for toForm.

For instance, the previous example can be simplified into this:

data Person = Person
  { name :: String
  , age  :: Int
  } deriving (Generic)

instance ToForm Person

The default implementation of toForm is genericToForm.

Minimal complete definition

Nothing

Methods

toForm :: a -> Form #

Convert a value into Form.

Instances

Instances details
ToForm Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toForm :: Form -> Form #

ToHttpApiData v => ToForm (IntMap [v]) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toForm :: IntMap [v] -> Form #

(ToFormKey k, ToHttpApiData v) => ToForm [(k, v)] 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toForm :: [(k, v)] -> Form #

(ToFormKey k, ToHttpApiData v) => ToForm (Map k [v]) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toForm :: Map k [v] -> Form #

(ToFormKey k, ToHttpApiData v) => ToForm (HashMap k [v]) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

toForm :: HashMap k [v] -> Form #

class FromForm a where #

Parse Form into a value.

An example type and instance:

data Person = Person
  { name :: String
  , age  :: Int }

instance FromForm Person where
  fromForm f = Person
    <$> parseUnique "name" f
    <*> parseUnique "age"  f

Instead of manually writing FromForm instances you can use a default generic implementation of fromForm.

To do that, simply add deriving Generic clause to your datatype and declare a FromForm instance for your datatype without giving definition for fromForm.

For instance, the previous example can be simplified into this:

data Person = Person
  { name :: String
  , age  :: Int
  } deriving (Generic)

instance FromForm Person

The default implementation of fromForm is genericFromForm. It only works for records and it will use parseQueryParam for each field's value.

Minimal complete definition

Nothing

Methods

fromForm :: Form -> Either Text a #

Parse Form into a value.

Instances

Instances details
FromForm Form 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

fromForm :: Form -> Either Text Form #

FromHttpApiData v => FromForm (IntMap [v]) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

fromForm :: Form -> Either Text (IntMap [v]) #

(FromFormKey k, FromHttpApiData v) => FromForm [(k, v)]

_NOTE:_ this conversion is unstable and may result in different key order (but not values).

Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

fromForm :: Form -> Either Text [(k, v)] #

(Ord k, FromFormKey k, FromHttpApiData v) => FromForm (Map k [v]) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

fromForm :: Form -> Either Text (Map k [v]) #

(Eq k, Hashable k, FromFormKey k, FromHttpApiData v) => FromForm (HashMap k [v]) 
Instance details

Defined in Web.Internal.FormUrlEncoded

Methods

fromForm :: Form -> Either Text (HashMap k [v]) #

data FormOptions #

Generic-based deriving options for ToForm and FromForm.

A common use case for non-default FormOptions is to strip a prefix off of field labels:

data Project = Project
  { projectName :: String
  , projectSize :: Int
  } deriving (Generic, Show)

myOptions :: FormOptions
myOptions = FormOptions
 { fieldLabelModifier = map toLower . drop (length "project") }

instance ToForm Project where
  toForm = genericToForm myOptions

instance FromForm Project where
  fromForm = genericFromForm myOptions
>>> urlEncodeAsFormStable Project { projectName = "http-api-data", projectSize = 172 }
"name=http-api-data&size=172"
>>> urlDecodeAsForm "name=http-api-data&size=172" :: Either Text Project
Right (Project {projectName = "http-api-data", projectSize = 172})

Constructors

FormOptions 

Fields

readTextData :: Read a => Text -> Either Text a #

Parse URL piece using Read instance.

Use for types which do not involve letters:

>>> readTextData "1991-06-02" :: Either Text Day
Right 1991-06-02

This parser is case sensitive and will not match showTextData in presence of letters:

>>> readTextData (showTextData True) :: Either Text Bool
Left "could not parse: `true'"

See parseBoundedTextData.

parseBoundedHeader :: (ToHttpApiData a, Bounded a, Enum a) => ByteString -> Either Text a #

Parse values based on ToHttpApiData instance. Uses toHeader to get possible values.

parseBoundedQueryParam :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a #

Case insensitive.

Parse values case insensitively based on ToHttpApiData instance. Uses toQueryParam to get possible values.

parseBoundedUrlPiece :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a #

Case insensitive.

Parse values case insensitively based on ToHttpApiData instance. Uses toUrlPiece to get possible values.

parseBoundedEnumOfI :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text a #

Case insensitive.

Parse values case insensitively based on a precalculated mapping of their Text representations.

>>> parseBoundedEnumOfI toUrlPiece "FALSE" :: Either Text Bool
Right False

For case sensitive parser see parseBoundedEnumOf.

parseBoundedEnumOf :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text a #

Parse values based on a precalculated mapping of their Text representation.

>>> parseBoundedEnumOf toUrlPiece "true" :: Either Text Bool
Right True

For case insensitive parser see parseBoundedEnumOfI.

parseBoundedTextData :: (Show a, Bounded a, Enum a) => Text -> Either Text a #

Case insensitive.

Parse values case insensitively based on Show instance.

>>> parseBoundedTextData "true" :: Either Text Bool
Right True
>>> parseBoundedTextData "FALSE" :: Either Text Bool
Right False

This can be used as a default implementation for enumeration types:

>>> data MyData = Foo | Bar | Baz deriving (Show, Bounded, Enum)
>>> instance FromHttpApiData MyData where parseUrlPiece = parseBoundedTextData
>>> parseUrlPiece "foo" :: Either Text MyData
Right Foo

parseQueryParamWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a #

Case insensitive.

Parse given text case insensitive and then parse the rest of the input using parseQueryParam.

>>> parseQueryParamWithPrefix "z" "z10" :: Either Text Int
Right 10

parseHeaderWithPrefix :: FromHttpApiData a => ByteString -> ByteString -> Either Text a #

Parse given bytestring then parse the rest of the input using parseHeader.

data BasicAuthToken = BasicAuthToken Text deriving (Show)

instance FromHttpApiData BasicAuthToken where
  parseHeader h     = BasicAuthToken <$> parseHeaderWithPrefix "Basic " h
  parseQueryParam p = BasicAuthToken <$> parseQueryParam p
>>> parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")

parseUrlPieceWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text a #

Case insensitive.

Parse given text case insensitive and then parse the rest of the input using parseUrlPiece.

>>> parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
Right 10
>>> parseUrlPieceWithPrefix "Left " "left" :: Either Text Bool
Left "could not parse: `left'"

This can be used to implement FromHttpApiData for single field constructors:

>>> data Foo = Foo Int deriving (Show)
>>> instance FromHttpApiData Foo where parseUrlPiece s = Foo <$> parseUrlPieceWithPrefix "Foo " s
>>> parseUrlPiece "foo 1" :: Either Text Foo
Right (Foo 1)

showTextData :: Show a => a -> Text #

Lower case.

Convert to URL piece using Show instance. The result is always lower cased.

>>> showTextData True
"true"

This can be used as a default implementation for enumeration types:

>>> data MyData = Foo | Bar | Baz deriving (Show)
>>> instance ToHttpApiData MyData where toUrlPiece = showTextData
>>> toUrlPiece Foo
"foo"

parseQueryParamMaybe :: FromHttpApiData a => Text -> Maybe a #

Parse query param value in a Maybe.

>>> parseQueryParamMaybe "true" :: Maybe Bool
Just True

parseHeaderMaybe :: FromHttpApiData a => ByteString -> Maybe a #

Parse HTTP header value in a Maybe.

>>> parseHeaderMaybe "hello" :: Maybe Text
Just "hello"

parseUrlPieceMaybe :: FromHttpApiData a => Text -> Maybe a #

Parse URL path piece in a Maybe.

>>> parseUrlPieceMaybe "12" :: Maybe Int
Just 12

parseQueryParams :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a) #

Parse multiple query parameters.

>>> parseQueryParams ["1", "2", "3"] :: Either Text [Int]
Right [1,2,3]
>>> parseQueryParams ["64", "128", "256"] :: Either Text [Word8]
Left "out of bounds: `256' (should be between 0 and 255)"

toQueryParams :: (Functor t, ToHttpApiData a) => t a -> t Text #

Convert multiple values to a list of query parameter values.

>>> toQueryParams [fromGregorian 2015 10 03, fromGregorian 2015 12 01] :: [Text]
["2015-10-03","2015-12-01"]

parseUrlPieces :: (Traversable t, FromHttpApiData a) => t Text -> Either Text (t a) #

Parse multiple URL pieces.

>>> parseUrlPieces ["true", "false"] :: Either Text [Bool]
Right [True,False]
>>> parseUrlPieces ["123", "hello", "world"] :: Either Text [Int]
Left "could not parse: `hello' (input does not start with a digit)"

toUrlPieces :: (Functor t, ToHttpApiData a) => t a -> t Text #

Convert multiple values to a list of URL pieces.

>>> toUrlPieces [1, 2, 3] :: [Text]
["1","2","3"]

class ToHttpApiData a where #

Convert value to HTTP API data.

WARNING: Do not derive this using DeriveAnyClass as the generated instance will loop indefinitely.

Minimal complete definition

toUrlPiece | toQueryParam

Methods

toUrlPiece :: a -> Text #

Convert to URL path piece.

toEncodedUrlPiece :: a -> Builder #

Convert to a URL path piece, making sure to encode any special chars. The default definition uses urlEncodeBuilder False but this may be overriden with a more efficient version.

toHeader :: a -> ByteString #

Convert to HTTP header value.

toQueryParam :: a -> Text #

Convert to query param value.

toEncodedQueryParam :: a -> Builder #

Convert to URL query param, The default definition uses urlEncodeBuilder True but this may be overriden with a more efficient version.

Since: http-api-data-0.5.1

Instances

Instances details
ToHttpApiData All 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Any 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Version
>>> toUrlPiece (Version [1, 2, 3] [])
"1.2.3"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Void 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Int16 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Int32 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Int64 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Int8 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Word16 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Word32 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Word64 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Word8 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData SetCookie

Note: this instance works correctly for alphanumeric name and value

>>> let Right c = parseUrlPiece "SESSID=r2t5uvjq435r4q7ib3vtdjq120" :: Either Text SetCookie
>>> toUrlPiece c
"SESSID=r2t5uvjq435r4q7ib3vtdjq120"
>>> toHeader c
"SESSID=r2t5uvjq435r4q7ib3vtdjq120"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Ordering 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Path 
Instance details

Defined in Mig.Core.Api

ToHttpApiData PathItem 
Instance details

Defined in Mig.Core.Api

ToHttpApiData Text 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Text 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Day
>>> toUrlPiece (fromGregorian 2015 10 03)
"2015-10-03"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Month
>>> import Data.Time.Calendar.Month.Compat (Month (..))
>>> MkMonth 24482
2040-03
>>> toUrlPiece $ MkMonth 24482
"2040-03"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Quarter
>>> import Data.Time.Calendar.Quarter.Compat (Quarter (..))
>>> MkQuarter 8040
2010-Q1
>>> toUrlPiece $ MkQuarter 8040
"2010-q1"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData QuarterOfYear
>>> toUrlPiece Q4
"q4"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData DayOfWeek
>>> toUrlPiece Monday
"monday"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData NominalDiffTime 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData UTCTime
>>> toUrlPiece $ UTCTime (fromGregorian 2015 10 03) 864.5
"2015-10-03T00:14:24.500Z"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData LocalTime
>>> toUrlPiece $ LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 21.687)
"2015-10-03T14:55:21.687"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData TimeOfDay
>>> toUrlPiece $ TimeOfDay 14 55 23.1
"14:55:23.100"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData ZonedTime
>>> toUrlPiece $ ZonedTime (LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 51.001)) utc
"2015-10-03T14:55:51.001Z"
>>> toUrlPiece $ ZonedTime (LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 51.001)) (TimeZone 120 True "EET")
"2015-10-03T14:55:51.001+02:00"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData UUID 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData String 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Integer 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Natural 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData ()
>>> toUrlPiece ()
"_"
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Bool 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Char 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Double 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Float 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Int 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData Word 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Identity a)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (First a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Last a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (First a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Last a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Max a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Min a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Dual a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Product a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Sum a) 
Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Maybe a)
>>> toUrlPiece (Just "Hello")
"just Hello"
Instance details

Defined in Web.Internal.HttpApiData

(ToHttpApiData a, ToHttpApiData b) => ToHttpApiData (Either a b)
>>> toUrlPiece (Left "err" :: Either String Int)
"left err"
>>> toUrlPiece (Right 3 :: Either String Int)
"right 3"
Instance details

Defined in Web.Internal.HttpApiData

HasResolution a => ToHttpApiData (Fixed a)

Note: this instance is not polykinded

Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Const a b)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.HttpApiData

ToHttpApiData a => ToHttpApiData (Tagged b a)

Note: this instance is not polykinded

Instance details

Defined in Web.Internal.HttpApiData

class FromHttpApiData a where #

Parse value from HTTP API data.

WARNING: Do not derive this using DeriveAnyClass as the generated instance will loop indefinitely.

Minimal complete definition

parseUrlPiece | parseQueryParam

Methods

parseUrlPiece :: Text -> Either Text a #

Parse URL path piece.

parseHeader :: ByteString -> Either Text a #

Parse HTTP header value.

parseQueryParam :: Text -> Either Text a #

Parse query param value.

Instances

Instances details
FromHttpApiData All 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Any 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Version
>>> showVersion <$> parseUrlPiece "1.2.3"
Right "1.2.3"
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Void

Parsing a Void value is always an error, considering Void as a data type with no constructors.

Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Int16 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Int32 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Int64 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Int8 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Word16 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Word32 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Word64 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Word8 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData SetCookie

Note: this instance works correctly for alphanumeric name and value

>>> parseUrlPiece "SESSID=r2t5uvjq435r4q7ib3vtdjq120" :: Either Text SetCookie
Right (SetCookie {setCookieName = "SESSID", setCookieValue = "r2t5uvjq435r4q7ib3vtdjq120", setCookiePath = Nothing, setCookieExpires = Nothing, setCookieMaxAge = Nothing, setCookieDomain = Nothing, setCookieHttpOnly = False, setCookieSecure = False, setCookieSameSite = Nothing})
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Ordering 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Text 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Text 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Day
>>> toGregorian <$> parseUrlPiece "2016-12-01"
Right (2016,12,1)
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Month
>>> parseUrlPiece "2021-01" :: Either Text Month
Right 2021-01
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Quarter
>>> parseUrlPiece "2021-q1" :: Either Text Quarter
Right 2021-Q1
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData QuarterOfYear
>>> parseUrlPiece "q2" :: Either Text QuarterOfYear
Right Q2
>>> parseUrlPiece "Q3" :: Either Text QuarterOfYear
Right Q3
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData DayOfWeek
>>> parseUrlPiece "Monday" :: Either Text DayOfWeek
Right Monday
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData NominalDiffTime 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData UTCTime
>>> parseUrlPiece "2015-10-03T00:14:24Z" :: Either Text UTCTime
Right 2015-10-03 00:14:24 UTC
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData LocalTime
>>> parseUrlPiece "2015-10-03T14:55:01" :: Either Text LocalTime
Right 2015-10-03 14:55:01
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData TimeOfDay
>>> parseUrlPiece "14:55:01.333" :: Either Text TimeOfDay
Right 14:55:01.333
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData ZonedTime
>>> parseUrlPiece "2015-10-03T14:55:01+0000" :: Either Text ZonedTime
Right 2015-10-03 14:55:01 +0000
>>> parseQueryParam "2016-12-31T01:00:00Z" :: Either Text ZonedTime
Right 2016-12-31 01:00:00 +0000
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData UUID 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData String 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Integer 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Natural 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData ()
>>> parseUrlPiece "_" :: Either Text ()
Right ()
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Bool 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Char 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Double 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Float 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Int 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData Word 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Identity a)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (First a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Last a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (First a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Last a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Max a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Min a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Dual a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Product a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Sum a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Maybe a)
>>> parseUrlPiece "Just 123" :: Either Text (Maybe Int)
Right (Just 123)
Instance details

Defined in Web.Internal.HttpApiData

(FromHttpApiData a, FromHttpApiData b) => FromHttpApiData (Either a b)
>>> parseUrlPiece "Right 123" :: Either Text (Either String Int)
Right (Right 123)
Instance details

Defined in Web.Internal.HttpApiData

HasResolution a => FromHttpApiData (Fixed a)

Note: this instance is not polykinded

Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Const a b)

Since: http-api-data-0.4.2

Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (Tagged b a)

Note: this instance is not polykinded

Instance details

Defined in Web.Internal.HttpApiData

newtype LenientData a #

Lenient parameters. FromHttpApiData combinators always return Right.

Since: http-api-data-0.3.5

Constructors

LenientData 

Instances

Instances details
Foldable LenientData 
Instance details

Defined in Web.Internal.HttpApiData

Methods

fold :: Monoid m => LenientData m -> m #

foldMap :: Monoid m => (a -> m) -> LenientData a -> m #

foldMap' :: Monoid m => (a -> m) -> LenientData a -> m #

foldr :: (a -> b -> b) -> b -> LenientData a -> b #

foldr' :: (a -> b -> b) -> b -> LenientData a -> b #

foldl :: (b -> a -> b) -> b -> LenientData a -> b #

foldl' :: (b -> a -> b) -> b -> LenientData a -> b #

foldr1 :: (a -> a -> a) -> LenientData a -> a #

foldl1 :: (a -> a -> a) -> LenientData a -> a #

toList :: LenientData a -> [a] #

null :: LenientData a -> Bool #

length :: LenientData a -> Int #

elem :: Eq a => a -> LenientData a -> Bool #

maximum :: Ord a => LenientData a -> a #

minimum :: Ord a => LenientData a -> a #

sum :: Num a => LenientData a -> a #

product :: Num a => LenientData a -> a #

Traversable LenientData 
Instance details

Defined in Web.Internal.HttpApiData

Methods

traverse :: Applicative f => (a -> f b) -> LenientData a -> f (LenientData b) #

sequenceA :: Applicative f => LenientData (f a) -> f (LenientData a) #

mapM :: Monad m => (a -> m b) -> LenientData a -> m (LenientData b) #

sequence :: Monad m => LenientData (m a) -> m (LenientData a) #

Functor LenientData 
Instance details

Defined in Web.Internal.HttpApiData

Methods

fmap :: (a -> b) -> LenientData a -> LenientData b #

(<$) :: a -> LenientData b -> LenientData a #

Data a => Data (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LenientData a -> c (LenientData a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LenientData a) #

toConstr :: LenientData a -> Constr #

dataTypeOf :: LenientData a -> DataType #

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

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

gmapT :: (forall b. Data b => b -> b) -> LenientData a -> LenientData a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LenientData a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LenientData a -> r #

gmapQ :: (forall d. Data d => d -> u) -> LenientData a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LenientData a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LenientData a -> m (LenientData a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LenientData a -> m (LenientData a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LenientData a -> m (LenientData a) #

Read a => Read (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

Show a => Show (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

Eq a => Eq (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

Ord a => Ord (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

FromHttpApiData a => FromHttpApiData (LenientData a) 
Instance details

Defined in Web.Internal.HttpApiData

statusIsServerError :: Status -> Bool #

Server Error class

statusIsClientError :: Status -> Bool #

Client Error class

statusIsRedirection :: Status -> Bool #

Redirection class

statusIsSuccessful :: Status -> Bool #

Successful class

statusIsInformational :: Status -> Bool #

Informational class

networkAuthenticationRequired511 :: Status #

Network Authentication Required 511 (RFC 6585)

status511 :: Status #

Network Authentication Required 511 (RFC 6585)

httpVersionNotSupported505 :: Status #

HTTP Version Not Supported 505

status505 :: Status #

HTTP Version Not Supported 505

gatewayTimeout504 :: Status #

Gateway Timeout 504

status504 :: Status #

Gateway Timeout 504

serviceUnavailable503 :: Status #

Service Unavailable 503

status503 :: Status #

Service Unavailable 503

badGateway502 :: Status #

Bad Gateway 502

status502 :: Status #

Bad Gateway 502

notImplemented501 :: Status #

Not Implemented 501

status501 :: Status #

Not Implemented 501

internalServerError500 :: Status #

Internal Server Error 500

status500 :: Status #

Internal Server Error 500

requestHeaderFieldsTooLarge431 :: Status #

Request Header Fields Too Large 431 (RFC 6585)

status431 :: Status #

Request Header Fields Too Large 431 (RFC 6585)

tooManyRequests429 :: Status #

Too Many Requests 429 (RFC 6585)

status429 :: Status #

Too Many Requests 429 (RFC 6585)

preconditionRequired428 :: Status #

Precondition Required 428 (RFC 6585)

status428 :: Status #

Precondition Required 428 (RFC 6585)

unprocessableEntity422 :: Status #

Unprocessable Entity 422 (RFC 4918)

status422 :: Status #

Unprocessable Entity 422 (RFC 4918)

imATeapot418 :: Status #

I'm a teapot 418

status418 :: Status #

I'm a teapot 418

expectationFailed417 :: Status #

Expectation Failed 417

status417 :: Status #

Expectation Failed 417

requestedRangeNotSatisfiable416 :: Status #

Requested Range Not Satisfiable 416

status416 :: Status #

Requested Range Not Satisfiable 416

unsupportedMediaType415 :: Status #

Unsupported Media Type 415

status415 :: Status #

Unsupported Media Type 415

requestURITooLong414 :: Status #

Request-URI Too Long 414

status414 :: Status #

Request-URI Too Long 414

requestEntityTooLarge413 :: Status #

Request Entity Too Large 413

status413 :: Status #

Request Entity Too Large 413

preconditionFailed412 :: Status #

Precondition Failed 412

status412 :: Status #

Precondition Failed 412

lengthRequired411 :: Status #

Length Required 411

status411 :: Status #

Length Required 411

gone410 :: Status #

Gone 410

status410 :: Status #

Gone 410

conflict409 :: Status #

Conflict 409

status409 :: Status #

Conflict 409

requestTimeout408 :: Status #

Request Timeout 408

status408 :: Status #

Request Timeout 408

proxyAuthenticationRequired407 :: Status #

Proxy Authentication Required 407

status407 :: Status #

Proxy Authentication Required 407

notAcceptable406 :: Status #

Not Acceptable 406

status406 :: Status #

Not Acceptable 406

methodNotAllowed405 :: Status #

Method Not Allowed 405

status405 :: Status #

Method Not Allowed 405

notFound404 :: Status #

Not Found 404

status404 :: Status #

Not Found 404

forbidden403 :: Status #

Forbidden 403

status403 :: Status #

Forbidden 403

paymentRequired402 :: Status #

Payment Required 402

status402 :: Status #

Payment Required 402

unauthorized401 :: Status #

Unauthorized 401

status401 :: Status #

Unauthorized 401

badRequest400 :: Status #

Bad Request 400

status400 :: Status #

Bad Request 400

permanentRedirect308 :: Status #

Permanent Redirect 308

status308 :: Status #

Permanent Redirect 308

temporaryRedirect307 :: Status #

Temporary Redirect 307

status307 :: Status #

Temporary Redirect 307

useProxy305 :: Status #

Use Proxy 305

status305 :: Status #

Use Proxy 305

notModified304 :: Status #

Not Modified 304

status304 :: Status #

Not Modified 304

seeOther303 :: Status #

See Other 303

status303 :: Status #

See Other 303

found302 :: Status #

Found 302

status302 :: Status #

Found 302

movedPermanently301 :: Status #

Moved Permanently 301

status301 :: Status #

Moved Permanently 301

multipleChoices300 :: Status #

Multiple Choices 300

status300 :: Status #

Multiple Choices 300

partialContent206 :: Status #

Partial Content 206

status206 :: Status #

Partial Content 206

resetContent205 :: Status #

Reset Content 205

status205 :: Status #

Reset Content 205

noContent204 :: Status #

No Content 204

status204 :: Status #

No Content 204

nonAuthoritative203 :: Status #

Non-Authoritative Information 203

status203 :: Status #

Non-Authoritative Information 203

accepted202 :: Status #

Accepted 202

status202 :: Status #

Accepted 202

created201 :: Status #

Created 201

status201 :: Status #

Created 201

ok200 :: Status #

OK 200

status200 :: Status #

OK 200

switchingProtocols101 :: Status #

Switching Protocols 101

status101 :: Status #

Switching Protocols 101

continue100 :: Status #

Continue 100

status100 :: Status #

Continue 100

mkStatus :: Int -> ByteString -> Status #

Create a Status from status code and message.

data Status #

HTTP Status.

Only the statusCode is used for comparisons.

Please use mkStatus to create status codes from code and message, or the Enum instance or the status code constants (like ok200). There might be additional record members in the future.

Note that the Show instance is only for debugging.

Constructors

Status 

Instances

Instances details
Bounded Status 
Instance details

Defined in Network.HTTP.Types.Status

Enum Status 
Instance details

Defined in Network.HTTP.Types.Status

Show Status 
Instance details

Defined in Network.HTTP.Types.Status

Eq Status 
Instance details

Defined in Network.HTTP.Types.Status

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

Ord Status 
Instance details

Defined in Network.HTTP.Types.Status

type RequestHeaders = [Header] #

Request Headers

type ResponseHeaders = [Header] #

Response Headers

class Typeable a => ToSchema a where #

Convert a type into Schema.

An example type and instance:

{-# LANGUAGE OverloadedStrings #-}   -- allows to write Text literals
{-# LANGUAGE OverloadedLists #-}     -- allows to write Map and HashMap as lists

import Control.Lens
import Data.Proxy
import Data.OpenApi

data Coord = Coord { x :: Double, y :: Double }

instance ToSchema Coord where
  declareNamedSchema _ = do
    doubleSchema <- declareSchemaRef (Proxy :: Proxy Double)
    return $ NamedSchema (Just "Coord") $ mempty
      & type_ ?~ OpenApiObject
      & properties .~
          [ ("x", doubleSchema)
          , ("y", doubleSchema)
          ]
      & required .~ [ "x", "y" ]

Instead of manually writing your ToSchema instance you can use a default generic implementation of declareNamedSchema.

To do that, simply add deriving Generic clause to your datatype and declare a ToSchema instance for your datatype without giving definition for declareNamedSchema.

For instance, the previous example can be simplified into this:

{-# LANGUAGE DeriveGeneric #-}

import GHC.Generics (Generic)

data Coord = Coord { x :: Double, y :: Double } deriving Generic

instance ToSchema Coord

Minimal complete definition

Nothing

Methods

declareNamedSchema :: Proxy a -> Declare (Definitions Schema) NamedSchema #

Convert a type into an optionally named schema together with all used definitions. Note that the schema itself is included in definitions only if it is recursive (and thus needs its definition in scope).

Instances

Instances details
ToSchema Object 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema All 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Any 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Version 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Int16 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Int32 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Int64 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Int8 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Word16 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Word32 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Word64 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Word8 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchemaByteStringError ByteString :: Constraint) => ToSchema ByteString 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchemaByteStringError ByteString :: Constraint) => ToSchema ByteString 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema IntSet 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Scientific 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Text 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Text 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Day

Format "date" corresponds to yyyy-mm-dd format.

Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema NominalDiffTime 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema UTCTime
>>> toSchema (Proxy :: Proxy UTCTime) ^. format
Just "yyyy-mm-ddThh:MM:ssZ"
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema LocalTime
>>> toSchema (Proxy :: Proxy LocalTime) ^. format
Just "yyyy-mm-ddThh:MM:ss"
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema TimeOfDay 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema ZonedTime

Format "date-time" corresponds to yyyy-mm-ddThh:MM:ss(Z|+hh:MM) format.

Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema UUID

For ToJSON instance, see uuid-aeson package.

Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema String 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Integer 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Natural 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema () 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Bool 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Char 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Double 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Float 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Int 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema Word 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Identity a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (First a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Last a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Dual a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Product a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Sum a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (IntMap a)

NOTE: This schema does not account for the uniqueness of keys.

Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Set a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (HashSet a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (NonEmpty a)

Since: openapi3-2.2.1

Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema (Maybe a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

ToSchema a => ToSchema [a] 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchema a, ToSchema b) => ToSchema (Either a b) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(Typeable (Fixed a), HasResolution a) => ToSchema (Fixed a) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchema a, ToSchema b) => ToSchema (a, b) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchema a, ToSchema b, ToSchema c) => ToSchema (a, b, c) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchema a, ToSchema b, ToSchema c, ToSchema d) => ToSchema (a, b, c, d) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e) => ToSchema (a, b, c, d, e) 
Instance details

Defined in Data.OpenApi.Internal.Schema

(ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e, ToSchema f) => ToSchema (a, b, c, d, e, f) 
Instance details

Defined in Data.OpenApi.Internal.Schema

Methods

declareNamedSchema :: Proxy (a, b, c, d, e, f) -> Declare (Definitions Schema) NamedSchema #

(ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e, ToSchema f, ToSchema g) => ToSchema (a, b, c, d, e, f, g) 
Instance details

Defined in Data.OpenApi.Internal.Schema

Methods

declareNamedSchema :: Proxy (a, b, c, d, e, f, g) -> Declare (Definitions Schema) NamedSchema #

class ToParamSchema a where #

Convert a type into a plain Schema.

In previous versions of the package there was a separate type called ParamSchema, which was included in a greater Schema. Now this is a single class, but distinction for schema generators for "simple" types is preserved.

ToParamSchema is suited only for primitive-like types without nested fields and such.

An example type and instance:

{-# LANGUAGE OverloadedStrings #-}   -- allows to write Text literals

import Control.Lens

data Direction = Up | Down

instance ToParamSchema Direction where
  toParamSchema _ = mempty
     & type_ ?~ OpenApiString
     & enum_ ?~ [ "Up", "Down" ]

Instead of manually writing your ToParamSchema instance you can use a default generic implementation of toParamSchema.

To do that, simply add deriving FPFormat clause to your datatype and declare a ToParamSchema instance for your datatype without giving definition for toParamSchema.

For instance, the previous example can be simplified into this:

{-# LANGUAGE DeriveGeneric #-}

import GHC.Generics (Generic)

data Direction = Up | Down deriving Generic

instance ToParamSchema Direction

Minimal complete definition

Nothing

Methods

toParamSchema :: Proxy a -> Schema #

Convert a type into a plain parameter schema.

>>> BSL.putStrLn $ encodePretty $ toParamSchema (Proxy :: Proxy Integer)
{
    "type": "integer"
}

Instances

Instances details
ToParamSchema All 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Any 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Version 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Int16 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Int32 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Int64 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Int8 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Word16 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Word32 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Word64 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Word8 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

(ToParamSchemaByteStringError ByteString :: Constraint) => ToParamSchema ByteString 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

(ToParamSchemaByteStringError ByteString :: Constraint) => ToParamSchema ByteString 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema SetCookie 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Scientific 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Text 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Text 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Day

Format "date" corresponds to yyyy-mm-dd format.

Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema NominalDiffTime 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema UTCTime
>>> toParamSchema (Proxy :: Proxy UTCTime) ^. format
Just "yyyy-mm-ddThh:MM:ssZ"
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema LocalTime
>>> toParamSchema (Proxy :: Proxy LocalTime) ^. format
Just "yyyy-mm-ddThh:MM:ss"
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema TimeOfDay
>>> toParamSchema (Proxy :: Proxy TimeOfDay) ^. format
Just "hh:MM:ss"
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema ZonedTime
>>> toParamSchema (Proxy :: Proxy ZonedTime) ^. format
Just "date-time"
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema UUID 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema String 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Integer 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Natural 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema ()
>>> BSL.putStrLn $ encodePretty $ toParamSchema (Proxy :: Proxy ())
{
    "enum": [
        "_"
    ],
    "type": "string"
}
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy () -> Schema #

ToParamSchema Bool 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Char 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Double 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Float 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Int 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema Word 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema a => ToParamSchema (Identity a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema a => ToParamSchema (First a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (First a) -> Schema #

ToParamSchema a => ToParamSchema (Last a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Last a) -> Schema #

ToParamSchema a => ToParamSchema (Dual a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Dual a) -> Schema #

ToParamSchema a => ToParamSchema (Product a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema a => ToParamSchema (Sum a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Sum a) -> Schema #

ToParamSchema a => ToParamSchema (Set a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Set a) -> Schema #

ToParamSchema a => ToParamSchema (HashSet a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

ToParamSchema a => ToParamSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Vector a) -> Schema #

ToParamSchema a => ToParamSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Vector a) -> Schema #

ToParamSchema a => ToParamSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Vector a) -> Schema #

ToParamSchema a => ToParamSchema (Vector a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Vector a) -> Schema #

ToParamSchema a => ToParamSchema [a] 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy [a] -> Schema #

HasResolution a => ToParamSchema (Fixed a) 
Instance details

Defined in Data.OpenApi.Internal.ParamSchema

Methods

toParamSchema :: Proxy (Fixed a) -> Schema #

data OpenApi #

This is the root document object for the API specification.

Instances

Instances details
FromJSON OpenApi 
Instance details

Defined in Data.OpenApi.Internal

ToJSON OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Data OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Methods

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

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

toConstr :: OpenApi -> Constr #

dataTypeOf :: OpenApi -> DataType #

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

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

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

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

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

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

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

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

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

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

Monoid OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Semigroup OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Generic OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Rep OpenApi :: Type -> Type #

Methods

from :: OpenApi -> Rep OpenApi x #

to :: Rep OpenApi x -> OpenApi #

Show OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Generic OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type Code OpenApi :: [[Type]] #

HasDatatypeInfo OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Associated Types

type DatatypeInfoOf OpenApi :: DatatypeInfo #

Eq OpenApi 
Instance details

Defined in Data.OpenApi.Internal

Methods

(==) :: OpenApi -> OpenApi -> Bool #

(/=) :: OpenApi -> OpenApi -> Bool #

HasSwaggerAesonOptions OpenApi 
Instance details

Defined in Data.OpenApi.Internal

HasComponents OpenApi Components 
Instance details

Defined in Data.OpenApi.Lens

HasInfo OpenApi Info 
Instance details

Defined in Data.OpenApi.Lens

Methods

info :: Lens' OpenApi Info #

HasOpenapi OpenApi OpenApiSpecVersion 
Instance details

Defined in Data.OpenApi.Lens

HasExternalDocs OpenApi (Maybe ExternalDocs) 
Instance details

Defined in Data.OpenApi.Lens

HasSecurity OpenApi [SecurityRequirement] 
Instance details

Defined in Data.OpenApi.Lens

HasServers OpenApi [Server] 
Instance details

Defined in Data.OpenApi.Lens

HasTags OpenApi (InsOrdHashSet Tag) 
Instance details

Defined in Data.OpenApi.Lens

HasPaths OpenApi (InsOrdHashMap FilePath PathItem) 
Instance details

Defined in Data.OpenApi.Lens

type Rep OpenApi 
Instance details

Defined in Data.OpenApi.Internal

type Code OpenApi 
Instance details

Defined in Data.OpenApi.Internal

type DatatypeInfoOf OpenApi 
Instance details

Defined in Data.OpenApi.Internal

mapDerive :: (Name -> Q [Dec]) -> [Name] -> Q [Dec] Source #

deriveNewtypeParam :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a newtype suitable for request parameter

deriveParam :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a type suitable for request parameter

deriveNewtypeBody :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a newtype suitable for request body or response

deriveBody :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a type suitable for request body or response

deriveNewtypeForm :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a newtype suitable for request form

deriveForm :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a type suitable for request form

deriveNewtypeParamBody :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a newtype which is both body and param

deriveParamBody :: Name -> Q [Dec] Source #

Derives standard WEB-classes for a type which is both body and param