Module

Yoga.HTTP.API.Route.HeaderValue

Package
purescript-yoga-http-api
Repository
rowtype-yoga/purescript-yoga-http-api

#HeaderValue Source

class HeaderValue a  where

Typeclass for values that can be parsed from and printed to HTTP header strings

This mirrors the ParseParam pattern from path parsing and allows headers to be typed beyond just strings.

Returns Either String for detailed error messages (the string is the reason, not the header name).

Examples: parseHeader "42" :: Either String Int = Right 42 parseHeader "bad" :: Either String Int = Left "not a valid integer" printHeader 42 = "42" parseHeader "hello" :: Either String String = Right "hello"

Members

Instances

  • HeaderValue String

    String headers are pass-through (identity)

  • HeaderValue Int

    Integer headers are parsed from strings

  • (HeaderValue a) => HeaderValue (Maybe a)

    Optional headers (Maybe a) where a has HeaderValue This instance allows headers to be optional Note: parseHeader always succeeds for Maybe types (returns Just or Nothing)

#HeaderValueType Source

class HeaderValueType (ty :: Type)  where

Get OpenAPI type string for a HeaderValue type

Members

Instances