Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Web.Hyperbole.Data.URI
Contents
Synopsis
- data URI = URI {}
- data URIAuth = URIAuth {
- uriUserInfo :: String
- uriRegName :: String
- uriPort :: String
- uri :: QuasiQuoter
- newtype Path = Path {}
- type Segment = Text
- path :: Text -> Path
- parseURIReference :: String -> Maybe URI
- pathUri :: Path -> URI
- uriToText :: URI -> Text
- pathToText :: Bool -> Path -> Text
- queryString :: [(ByteString, Maybe ByteString)] -> QueryString
- parseQuery :: ByteString -> Query
- queryInsert :: ByteString -> Maybe ByteString -> QueryString -> QueryString
- renderQuery :: Bool -> Query -> ByteString
- type Query = [QueryItem]
- type QueryItem = (ByteString, Maybe ByteString)
- (./.) :: URI -> Path -> URI
- (.?.) :: URI -> QueryItem -> URI
- cleanSegment :: Segment -> Segment
- newtype Endpoint a = Endpoint {}
URI
Represents a general universal resource identifier using its component parts.
For example, for the URI
foo://anonymous@www.haskell.org:42/ghc?query#frag
the components are:
Constructors
URI | |
Instances
Data URI | |
Defined in Network.URI Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URI -> c URI # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URI # dataTypeOf :: URI -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URI) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URI) # gmapT :: (forall b. Data b => b -> b) -> URI -> URI # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r # gmapQ :: (forall d. Data d => d -> u) -> URI -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> URI -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> URI -> m URI # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI # | |
Generic URI | |
Show URI | |
NFData URI | |
Defined in Network.URI | |
Eq URI | |
Ord URI | |
FromParam URI Source # | |
Defined in Web.Hyperbole.Data.Param Methods parseParam :: ParamValue -> Either String URI Source # | |
ToParam URI Source # | |
Defined in Web.Hyperbole.Data.Param Methods toParam :: URI -> ParamValue Source # | |
FromJSON URI | Since: aeson-2.2.0.0 |
Defined in Data.Aeson.Types.FromJSON | |
FromJSONKey URI | Since: aeson-2.2.0.0 |
Defined in Data.Aeson.Types.FromJSON | |
ToJSON URI | Since: aeson-2.2.0.0 |
ToJSONKey URI | Since: aeson-2.2.0.0 |
Defined in Data.Aeson.Types.ToJSON | |
Lift URI | |
type Rep URI | |
Defined in Network.URI type Rep URI = D1 ('MetaData "URI" "Network.URI" "ntwrk-r-2.6.4.2-33a473b9" 'False) (C1 ('MetaCons "URI" 'PrefixI 'True) ((S1 ('MetaSel ('Just "uriScheme") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "uriAuthority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe URIAuth))) :*: (S1 ('MetaSel ('Just "uriPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "uriQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "uriFragment") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))) |
Type for authority value within a URI
Constructors
URIAuth | |
Fields
|
Instances
Data URIAuth | |
Defined in Network.URI Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URIAuth -> c URIAuth # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URIAuth # toConstr :: URIAuth -> Constr # dataTypeOf :: URIAuth -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URIAuth) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URIAuth) # gmapT :: (forall b. Data b => b -> b) -> URIAuth -> URIAuth # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URIAuth -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URIAuth -> r # gmapQ :: (forall d. Data d => d -> u) -> URIAuth -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> URIAuth -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> URIAuth -> m URIAuth # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URIAuth -> m URIAuth # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URIAuth -> m URIAuth # | |
Generic URIAuth | |
Show URIAuth | |
NFData URIAuth | |
Defined in Network.URI | |
Eq URIAuth | |
Ord URIAuth | |
Lift URIAuth | |
type Rep URIAuth | |
Defined in Network.URI type Rep URIAuth = D1 ('MetaData "URIAuth" "Network.URI" "ntwrk-r-2.6.4.2-33a473b9" 'False) (C1 ('MetaCons "URIAuth" 'PrefixI 'True) (S1 ('MetaSel ('Just "uriUserInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "uriRegName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "uriPort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) |
uri :: QuasiQuoter #
Path
parseURIReference :: String -> Maybe URI #
Query String
queryString :: [(ByteString, Maybe ByteString)] -> QueryString Source #
parseQuery :: ByteString -> Query #
Split out the query string into a list of keys and values. A few importants points:
- The result returned is still bytestrings, since we perform no character decoding here. Most likely, you will want to use UTF-8 decoding, but this is left to the user of the library.
- Percent decoding errors are ignored. In particular,
"%Q"
will be output as"%Q"
. - It decodes
'+'
characters to' '
Since: http-types-0.2.0
queryInsert :: ByteString -> Maybe ByteString -> QueryString -> QueryString Source #
renderQuery :: Bool -> Query -> ByteString #
Renders the given Query
into a ByteString
.
If you want a question mark (?
) added to the front of the result, use True
.
Since: http-types-0.2.0
type QueryItem = (ByteString, Maybe ByteString) #
An item from the query string, split up into two parts.
The second part should be Nothing
if there was no key-value
separator after the query item name.
Since: http-types-0.2.0
cleanSegment :: Segment -> Segment Source #