h&2j)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred "%1?|mig Server configmigValues convertible to lazy textmigSize of the input bodymigServer 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" /. mconcat [ "foo" /. (\(Query @"name" arg) -> Get @Json (handleFoo arg) , "bar" /. Post @Json handleBar ] handleFoo :: Int -> IO Text handleBar :: IO TextNote 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 parametersOptional - for optional query parametersCapture - for parsing elements of URIBody - fot JSON-body inputRawBody - for raw ByteString inputHeader - for headersTo 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: newtype Get ty m a = Get (m a)&Let's look at the arguments of he typety - type of the response. it can be: Text, Html, Json, ByteStringm - underlying server monada - result type. It should be convertible to the type of the response.also result can be wrapped to special data types to modify Http-response. we have wrappers: SetStatus - to set status AddHeaders - to append headersEither (Error err) - to response with errors mig'Map of query parameters for fast-access migErrorsmig Http requestmigURI pathmigquery parametersmigrequest headersmigrequest methodmiglazy body reader. Error can happen if size is too big (configured on running the server)migHttp response body!mig Http response#migstatus$migheaders%mig response body&migBad request responsemigRead request body in chunks0migHeaders to set content type2migJson response constructor3migText response constructor4migHtml response constructor5mig#Raw bytestring response constructor6migRespond with ok 200-status7mig Handle errors8mig!Convert server to WAI-application9mig*Convert response to low-level WAI-response:migRead request from low-level WAI-request First argument limits the size of input body. The body is read in chunks.;  !"%$#&'()*+,-./0123456789:;!"%$#  '(),+.*/32456&08179:- Safe-Inferred "%1? QEmigReads current path infoGmigReads input header. Example: "api" /. (\(Header @"Trace-Id" traceId) -> Post @Json (handleFoo traceId)) handleFoo :: Maybe ByteString -> IO FooResponseImigIt reads form as plain JSON-object where name of the form's field becomes a field of JSON-object and every value is Text.For example if submit a form with fields: name, password, date. We can read it in the data type: data User = User { name :: Text , passord :: Text , date :: Text }Note that we can not use FormBody and JSON-body at the same time. They occupy the same field in the HTTP-request.KmigParse raw form body. It includes named form arguments and file info. Note that we can not use FormBody and JSON-body at the same time. They occupy the same field in the HTTP-request.MmigReads raw body as lazy bytestring. We can limit the body size with server config. Example: "api" /. "upload" /. (\(RawBody content) -> handleUpload content)OmigReads Json body (lazy). We can limit the body size with server config. Example: >"api" /. "search" /. (\(Body request) -> handleSearch request)SmigOptional query parameter. Name is encoded as type-level string. Example: "api" /. handleFoo handleFoo :: Optional "name" -> Server IO handleFoo (Optional maybeArg) = ...UmigMandatary query parameter. Name is encoded as type-level string. Example: "api" /. handleFoo handleFoo :: Query "name" Int -> Server IO handleFoo (Query arg) = ...WmigOptions methodYmig Patch method[mig Delete method]mig Put method_mig Post methodamigGet method. Note that we can not use body input with Get-method, use Post for that. So with Get we can use only URI inputs (Query, Optional, Capture)cmigValues convertible to HtmlemigValues convertible to Jsongmig!Values convertible to Text (lazy)imigAttach headers to response. It can be used inside any ToXxxResp value. Example: "api" /. handleFoo handleFoo :: Get Text IO (AddHeaders Text) handleFoo = Get $ pure $ AddHeaders headers "Hello foo"mmigSet status to response. It can be ised inside any ToXxxResp value. Example: "api" /. handleFoo handleFoo :: Get Text IO (SetStatus Text) handleFoo = Get $ pure $ SetStatus status500 "Bad request"qmig0Class ToServer contains anything convertible to Server m. We use it for flexuble composition of servers from functions with arbitrary number of arguments. Arguments can be of specific types: Query, Body, Optional, Capture, Header, etc. We use type-level strings to encode query-names. Example: "api" /. "foo" /. (\(Query @"argA" argA) (Optional @"argB" argB) (Body jsonRequest) -> Post @Json $ handleFoo argA argB jsonRequest) handleFoo :: Int -> Maybe Text -> FooRequest -> IO FooResponse handleFoo = ...Note that we can use any amount of arguments. And type of the input is decoded fron newtype wrapper which is used with argument of the handler function.Also we can return pure errors with Either. Anything which can be returned from function can be wrapped to Either (Error err).For example in previous case we can use function which returns errors as values: type ServerError = Error Text handleFoo :: Int -> Maybe Text -> FooRequest -> IO (Either ServerError FooResponse) handleFoo = ...the result of error response is automatically matched with normal response of the server and standard Error type lets us pass status to response and some details.tmigType tag of Json-response.umigClass 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.xmigAything convertible from textzmig.Path constructor (right associative). Example: server :: Server IO server = "api" /. "v1" /. mconcat [ "foo" /. Get @Json handleFoo , "bar" /. Post @Json handleBar ] handleFoo, handleBar :: IO Textmig Map internal monad of the server{mig'Render reader server to IO-based server|mig&Sets status for response of the server}mig'Adds headers for response of the server~migAppends action to the servermigRun server on port &78EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijlkmnpoqrstuvwxyz{|}~tab_`]^[\YZWXzQRUVSTOPMNGHKLIJEFijlkmnpo|} 78uvw{ghefcdxy&qrs~z4 Safe-Inferred "%1?! &78EFGHIJKLMNOPQRSTUVcdijlkmnpoqrsuvwxyz{|}~=cdxyqrs~zQRUVSTOPMNGHKLIJEFijlkmnpo|} 7uvw{8& Safe-Inferred "%1?# &78EFGHIJKLMNOPQRSTUVcdikjlmonpqrsruvwvxyz{|}~  Safe-Inferred "%1?$ &78EFGHIJKLMNOPQRSTUVcdikjlmonpqrsruvwvxyz{|}~  Safe-Inferred "%1?&x &78EFGHIJKLMNOPQRSTUVcdikjlmonpqrsruvwvxyz{|}~  Safe-Inferred "%1?' &78EFGHIJKLMNOPQRSTUVcdikjlmonpqrsruvwvxyz{|}~  Safe-Inferred "%1?)m       !"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWXYZ[\]]^_``abcdefghijklmnopqrstuvwxyz{|}~QQRRSSTTUUVVQQRRSSTTUUVVQQRRSSTTUUVVQQRRSSTTUUVV"mig-0.1.0.1-5ORqKhlnWUbEp6iH2nyOaWMig.Internal.TypesMig Mig.Html.IOMig.HtmlMig.Json Mig.Json.IO Mig.Common Paths_mig ServerConfig$sel:maxBodySize:ServerConfigToTexttoText KilobytesServer$sel:unServer:ServerQueryMapError$sel:status:Error$sel:body:ErrorFormBody$sel:params:FormBody$sel:files:FormBodyReq $sel:path:Req$sel:query:Req$sel:headers:Req$sel:method:Req$sel:readBody:Req$sel:readFormBody:ReqRespBodyTextRespHtmlRespJsonRespFileResp StreamRespRawRespResp$sel:status:Resp$sel:headers:Resp$sel:body:Resp badRequesttoConsttoMethod toWithBodytoWithFormData toWithPath toWithCapturepathHead toWithHeadertoWithPathInfo setContent setRespStatusjsontexthtmlrawok handleError toApplication toResponse fromRequest$fIsStringResp$fExceptionError$fMonoidServer$fSemigroupServer $fToText[] $fToTextFloat $fToTextInt $fToTextText $fToTextText0 $fShowErrorPathInfoHeaderFormJson RawFormDataRawBodyBodyCaptureOptionalQueryOptionsPatchDeletePutPostGet ToHtmlResp toHtmlResp ToJsonResp toJsonResp ToTextResp toTextResp AddHeaders$sel:headers:AddHeaders$sel:content:AddHeaders SetStatus$sel:status:SetStatus$sel:content:SetStatusToServer ServerMonadtoServerJson HasServer ServerResult renderServerFromTextfromText/. fromReader setStatus addHeaderswithServerAction runServer$fFromTextFloat$fFromTextBool$fFromTextInteger $fFromTextInt$fFromTextWord$fFromTextText$fFromTextText0 $fFromText[]$fFromTextByteString$fHasServerReaderT$fHasServerReaderT0 $fHasServerIO$fToServerServer$fToTextRespEither$fToTextRespSetStatus$fToTextRespAddHeaders$fToTextRespInt$fToTextRespText$fToTextRespText0$fToJsonRespEither$fToJsonRespSetStatus$fToJsonRespAddHeaders $fToJsonRespa$fToHtmlRespEither$fToHtmlRespSetStatus$fToHtmlRespAddHeaders $fToHtmlRespa $fToServerGet$fToServerGet0$fToServerGet1$fToServerGet2$fToServerGet3$fToServerPost$fToServerPost0$fToServerPost1 $fToServerPut$fToServerPut0$fToServerPut1$fToServerDelete$fToServerDelete0$fToServerDelete1$fToServerPatch$fToServerPatch0$fToServerPatch1$fToServerOptions$fToServerOptions0$fToServerOptions1 $fToServerFUN$fToServerFUN0$fToServerFUN1$fToServerFUN2$fToServerFUN3$fToServerFUN4$fToServerFUN5$fToServerFUN6$fToServerFUN7$fIsStringQueryName $fEqQueryName$fOrdQueryName$fShowQueryNamereadRequestBody hoistServer(http-types-0.12.3-JlXMXDo7mr8Ke1ukSqfJrBNetwork.HTTP.Types.StatusstatusIsServerErrorstatusIsClientErrorstatusIsRedirectionstatusIsSuccessfulstatusIsInformational networkAuthenticationRequired511 status511httpVersionNotSupported505 status505gatewayTimeout504 status504serviceUnavailable503 status503 badGateway502 status502notImplemented501 status501internalServerError500 status500requestHeaderFieldsTooLarge431 status431tooManyRequests429 status429preconditionRequired428 status428upgradeRequired426 status426unprocessableEntity422 status422 imATeapot418 status418expectationFailed417 status417requestedRangeNotSatisfiable416 status416unsupportedMediaType415 status415requestURITooLong414 status414requestEntityTooLarge413 status413preconditionFailed412 status412lengthRequired411 status411gone410 status410 conflict409 status409requestTimeout408 status408proxyAuthenticationRequired407 status407notAcceptable406 status406methodNotAllowed405 status405 notFound404 status404 forbidden403 status403paymentRequired402 status402unauthorized401 status401 badRequest400 status400permanentRedirect308 status308temporaryRedirect307 status307 useProxy305 status305notModified304 status304 seeOther303 status303found302 status302movedPermanently301 status301multipleChoices300 status300partialContent206 status206resetContent205 status205 noContent204 status204nonAuthoritative203 status203 accepted202 status202 created201 status201ok200 status200switchingProtocols101 status101 continue100 status100mkStatusStatus statusMessage statusCodeversiongetDataFileName getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDir