modern-uri-0.3.6.1: Modern library for working with URIs

Copyright | © 2017–present Mark Karpov
License | BSD 3 clause
Maintainer | Mark Karpov <markkarpov92@gmail.com>
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.URI

Contents

- Data types
- Refined text
- Parsing
- Rendering

Description

This is a modern library for working with URIs as per RFC 3986:

https://tools.ietf.org/html/rfc3986

This module is intended to be imported qualified, e.g.:

    import Text.URI (URI)
    import qualified Text.URI as URI

See also Text.URI.Lens for lens, prisms, and traversals; see Text.URI.QQ for quasi-quoters for compile-time validation of URIs and refined text components.

Synopsis

- data URI = URI {
  - uriScheme :: Maybe (RText 'Scheme)
  - uriAuthority :: Either Bool Authority
  - uriPath :: Maybe (Bool, NonEmpty (RText 'PathPiece))
  - uriQuery :: [QueryParam]
  - uriFragment :: Maybe (RText 'Fragment)
  }
- mkURI :: MonadThrow m => Text -> m URI
- mkURIBs :: MonadThrow m => ByteString -> m URI
- emptyURI :: URI
- makeAbsolute :: RText 'Scheme -> URI -> URI
- isPathAbsolute :: URI -> Bool
- relativeTo :: URI -> URI -> Maybe URI
- data Authority = Authority {
  - authUserInfo :: Maybe UserInfo
  - authHost :: RText 'Host
  - authPort :: Maybe Word
  }
- data UserInfo = UserInfo {
  - uiUsername :: RText 'Username
  - uiPassword :: Maybe (RText 'Password)
  }
- data QueryParam
  - = QueryFlag (RText 'QueryKey)
  - | QueryParam (RText 'QueryKey) (RText 'QueryValue)
- newtype ParseException = ParseException (ParseErrorBundle Text Void)
- newtype ParseExceptionBs = ParseExceptionBs (ParseErrorBundle ByteString Void)
- data RText (l :: RTextLabel)
- data RTextLabel
  - = Scheme
  - | Host
  - | Username
  - | Password
  - | PathPiece
  - | QueryKey
  - | QueryValue
  - | Fragment
- mkScheme :: MonadThrow m => Text -> m (RText 'Scheme)
- mkHost :: MonadThrow m => Text -> m (RText 'Host)
- mkUsername :: MonadThrow m => Text -> m (RText 'Username)
- mkPassword :: MonadThrow m => Text -> m (RText 'Password)
- mkPathPiece :: MonadThrow m => Text -> m (RText 'PathPiece)
- mkQueryKey :: MonadThrow m => Text -> m (RText 'QueryKey)
- mkQueryValue :: MonadThrow m => Text -> m (RText 'QueryValue)
- mkFragment :: MonadThrow m => Text -> m (RText 'Fragment)
- unRText :: forall (l :: RTextLabel). RText l -> Text
- data RTextException = RTextException RTextLabel Text
- parser :: MonadParsec e Text m => m URI
- parserBs :: MonadParsec e ByteString m => m URI
- render :: URI -> Text
- render' :: URI -> Builder
- renderBs :: URI -> ByteString
- renderBs' :: URI -> Builder
- renderStr :: URI -> String
- renderStr' :: URI -> ShowS

# Data types

data URI Source #

Uniform resource identifier (URI) reference. We use refined `Text` (``RText` l`) here because information is presented in human-readable form, i.e. percent-decoded, and thus it may contain Unicode characters.

Constructors

URI |

Fields

- uriScheme :: Maybe (RText 'Scheme)

  URI scheme, if `Nothing`, then the URI reference is relative

- uriAuthority :: Either Bool Authority

  `Authority` component in `Right` or a `Bool` value in `Left` indicating if `uriPath` path is absolute (`True`) or relative (`False`); if we have an `Authority` component, then the path is necessarily absolute, see `isPathAbsolute`

  Note: before version 0.1.0.0 type of `uriAuthority` was ``Maybe` `Authority``

- uriPath :: Maybe (Bool, NonEmpty (RText 'PathPiece))

  `Nothing` represents the empty path, while `Just` contains an indication `Bool` whether the path component has a trailing slash, and the collection of path pieces ``NonEmpty` (`RText` `PathPiece`)`.

  Note: before version 0.2.0.0 type of `uriPath` was `[`RText` `PathPiece`]`.

- uriQuery :: [QueryParam]

  Query parameters, RFC 3986 does not define the inner organization of query string, so we deconstruct it following RFC 1866 here

- uriFragment :: Maybe (RText 'Fragment)

  Fragment, without `#`

#### Instances

Instances details

Arbitrary URI Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen URI Source # shrink :: URI -> [URI] Source #
NFData URI Source # |
Instance details Defined in Text.URI.Types Methods rnf :: URI -> () Source #
Data URI Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: URI -> Constr Source #

dataTypeOf :: URI -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic URI Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep URI |

Instance details

Defined in Text.URI.Types

type Rep URI = D1 ('MetaData "URI" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "URI" 'PrefixI 'True) ((S1 ('MetaSel ('Just "uriScheme") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (RText 'Scheme))) :*: S1 ('MetaSel ('Just "uriAuthority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either Bool Authority))) :*: (S1 ('MetaSel ('Just "uriPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Bool, NonEmpty (RText 'PathPiece)))) :*: (S1 ('MetaSel ('Just "uriQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [QueryParam]) :*: S1 ('MetaSel ('Just "uriFragment") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (RText 'Fragment)))))))

Methods

from :: URI -> Rep URI x Source #

to :: Rep URI x -> URI Source #

Show URI Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> URI -> ShowS Source # show :: URI -> String Source # showList :: [URI] -> ShowS Source #
Eq URI Source # |
Instance details Defined in Text.URI.Types Methods (==) :: URI -> URI -> Bool Source # (/=) :: URI -> URI -> Bool Source #
Ord URI Source # |
Instance details Defined in Text.URI.Types Methods compare :: URI -> URI -> Ordering Source # (<) :: URI -> URI -> Bool Source # (<=) :: URI -> URI -> Bool Source # (>) :: URI -> URI -> Bool Source # (>=) :: URI -> URI -> Bool Source # max :: URI -> URI -> URI Source # min :: URI -> URI -> URI Source #
Hashable URI Source # | Since: 0.3.5.0
Instance details Defined in Text.URI.Types Methods hashWithSalt :: Int -> URI -> Int Source # hash :: URI -> Int Source #
Lift URI Source # | Since: 0.3.1.0
Instance details Defined in Text.URI.Types Methods lift :: Quote m => URI -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => URI -> Code m URI Source #
type Rep URI Source # |

Instance details

Defined in Text.URI.Types

type Rep URI = D1 ('MetaData "URI" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "URI" 'PrefixI 'True) ((S1 ('MetaSel ('Just "uriScheme") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (RText 'Scheme))) :*: S1 ('MetaSel ('Just "uriAuthority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either Bool Authority))) :*: (S1 ('MetaSel ('Just "uriPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Bool, NonEmpty (RText 'PathPiece)))) :*: (S1 ('MetaSel ('Just "uriQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [QueryParam]) :*: S1 ('MetaSel ('Just "uriFragment") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (RText 'Fragment)))))))

mkURI :: MonadThrow m => Text -> m URI Source #

Construct a `URI` from `Text`. The input you pass to `mkURI` must be a valid URI as per RFC 3986, that is, its components should be percent-encoded where necessary. In case of parse failure `ParseException` is thrown.

This function uses the `parser` parser under the hood, which you can also use directly in a Megaparsec parser.

mkURIBs :: MonadThrow m => ByteString -> m URI Source #

Construct a `URI` from `ByteString`. The input you pass to `mkURIBs` must be a valid URI as per RFC 3986, that is, its components should be percent-encoded where necessary. In case of parse failure `ParseExceptionBs` is thrown.

This function uses the `parserBs` parser under the hood, which you can also use directly in a Megaparsec parser.

Since: 0.3.3.0

emptyURI :: URI Source #

The empty `URI`.

Since: 0.2.1.0

makeAbsolute :: RText 'Scheme -> URI -> URI Source #

Make a given `URI` reference absolute using the supplied ``RText` `Scheme`` if necessary.

isPathAbsolute :: URI -> Bool Source #

Return `True` if path in a given `URI` is absolute.

Since: 0.1.0.0

relativeTo Source #

Arguments

:: URI | Reference `URI` to make absolute
-> URI | Base `URI`
-> Maybe URI | The target `URI`

``relativeTo` reference base` makes the `reference` `URI` absolute resolving it against the `base` `URI`.

If the base `URI` is not absolute itself (that is, it has no scheme), this function returns `Nothing`.

See also: https://tools.ietf.org/html/rfc3986#section-5.2.

Since: 0.2.0.0

data Authority Source #

Authority component of `URI`.

Constructors

Authority |

Fields

- authUserInfo :: Maybe UserInfo

  User information

- authHost :: RText 'Host

  Host

- authPort :: Maybe Word

  Port number

#### Instances

Instances details

Arbitrary Authority Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen Authority Source # shrink :: Authority -> [Authority] Source #
NFData Authority Source # |
Instance details Defined in Text.URI.Types Methods rnf :: Authority -> () Source #
Data Authority Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: Authority -> Constr Source #

dataTypeOf :: Authority -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic Authority Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep Authority |

Instance details

Defined in Text.URI.Types

type Rep Authority = D1 ('MetaData "Authority" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "Authority" 'PrefixI 'True) (S1 ('MetaSel ('Just "authUserInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UserInfo)) :*: (S1 ('MetaSel ('Just "authHost") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'Host)) :*: S1 ('MetaSel ('Just "authPort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Word)))))

Methods

from :: Authority -> Rep Authority x Source #

to :: Rep Authority x -> Authority Source #

Show Authority Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> Authority -> ShowS Source # show :: Authority -> String Source # showList :: [Authority] -> ShowS Source #
Eq Authority Source # |
Instance details Defined in Text.URI.Types Methods (==) :: Authority -> Authority -> Bool Source # (/=) :: Authority -> Authority -> Bool Source #
Ord Authority Source # |
Instance details Defined in Text.URI.Types Methods compare :: Authority -> Authority -> Ordering Source # (<) :: Authority -> Authority -> Bool Source # (<=) :: Authority -> Authority -> Bool Source # (>) :: Authority -> Authority -> Bool Source # (>=) :: Authority -> Authority -> Bool Source # max :: Authority -> Authority -> Authority Source # min :: Authority -> Authority -> Authority Source #
Hashable Authority Source # | Since: 0.3.5.0
Instance details Defined in Text.URI.Types Methods hashWithSalt :: Int -> Authority -> Int Source # hash :: Authority -> Int Source #
Lift Authority Source # | Since: 0.3.1.0
Instance details Defined in Text.URI.Types Methods lift :: Quote m => Authority -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Authority -> Code m Authority Source #
type Rep Authority Source # |

Instance details

Defined in Text.URI.Types

type Rep Authority = D1 ('MetaData "Authority" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "Authority" 'PrefixI 'True) (S1 ('MetaSel ('Just "authUserInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UserInfo)) :*: (S1 ('MetaSel ('Just "authHost") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'Host)) :*: S1 ('MetaSel ('Just "authPort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Word)))))

data UserInfo Source #

User info as a combination of username and password.

Constructors

UserInfo |

Fields

- uiUsername :: RText 'Username

  Username

- uiPassword :: Maybe (RText 'Password)

  Password, `Nothing` means that there was no `:` character in the user info string

#### Instances

Instances details

Arbitrary UserInfo Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen UserInfo Source # shrink :: UserInfo -> [UserInfo] Source #
NFData UserInfo Source # |
Instance details Defined in Text.URI.Types Methods rnf :: UserInfo -> () Source #
Data UserInfo Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: UserInfo -> Constr Source #

dataTypeOf :: UserInfo -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic UserInfo Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep UserInfo |

Instance details

Defined in Text.URI.Types

type Rep UserInfo = D1 ('MetaData "UserInfo" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "UserInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "uiUsername") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'Username)) :*: S1 ('MetaSel ('Just "uiPassword") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (RText 'Password)))))

Methods

from :: UserInfo -> Rep UserInfo x Source #

to :: Rep UserInfo x -> UserInfo Source #

Show UserInfo Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> UserInfo -> ShowS Source # show :: UserInfo -> String Source # showList :: [UserInfo] -> ShowS Source #
Eq UserInfo Source # |
Instance details Defined in Text.URI.Types Methods (==) :: UserInfo -> UserInfo -> Bool Source # (/=) :: UserInfo -> UserInfo -> Bool Source #
Ord UserInfo Source # |
Instance details Defined in Text.URI.Types Methods compare :: UserInfo -> UserInfo -> Ordering Source # (<) :: UserInfo -> UserInfo -> Bool Source # (<=) :: UserInfo -> UserInfo -> Bool Source # (>) :: UserInfo -> UserInfo -> Bool Source # (>=) :: UserInfo -> UserInfo -> Bool Source # max :: UserInfo -> UserInfo -> UserInfo Source # min :: UserInfo -> UserInfo -> UserInfo Source #
Hashable UserInfo Source # | Since: 0.3.5.0
Instance details Defined in Text.URI.Types Methods hashWithSalt :: Int -> UserInfo -> Int Source # hash :: UserInfo -> Int Source #
Lift UserInfo Source # | Since: 0.3.1.0
Instance details Defined in Text.URI.Types Methods lift :: Quote m => UserInfo -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => UserInfo -> Code m UserInfo Source #
type Rep UserInfo Source # |

Instance details

Defined in Text.URI.Types

type Rep UserInfo = D1 ('MetaData "UserInfo" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "UserInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "uiUsername") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'Username)) :*: S1 ('MetaSel ('Just "uiPassword") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (RText 'Password)))))

data QueryParam Source #

Query parameter either in the form of flag or as a pair of key and value. A key cannot be empty, while a value can.

Constructors

QueryFlag (RText 'QueryKey) | Flag parameter
QueryParam (RText 'QueryKey) (RText 'QueryValue) | Key–value pair

#### Instances

Instances details

Arbitrary QueryParam Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen QueryParam Source # shrink :: QueryParam -> [QueryParam] Source #
NFData QueryParam Source # |
Instance details Defined in Text.URI.Types Methods rnf :: QueryParam -> () Source #
Data QueryParam Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: QueryParam -> Constr Source #

dataTypeOf :: QueryParam -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic QueryParam Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep QueryParam |

Instance details

Defined in Text.URI.Types

type Rep QueryParam = D1 ('MetaData "QueryParam" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "QueryFlag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'QueryKey))) :+: C1 ('MetaCons "QueryParam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'QueryKey)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'QueryValue))))

Methods

from :: QueryParam -> Rep QueryParam x Source #

to :: Rep QueryParam x -> QueryParam Source #

Show QueryParam Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> QueryParam -> ShowS Source # show :: QueryParam -> String Source # showList :: [QueryParam] -> ShowS Source #
Eq QueryParam Source # |
Instance details Defined in Text.URI.Types Methods (==) :: QueryParam -> QueryParam -> Bool Source # (/=) :: QueryParam -> QueryParam -> Bool Source #
Ord QueryParam Source # |

Instance details

Defined in Text.URI.Types

Methods

compare :: QueryParam -> QueryParam -> Ordering Source #

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

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

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

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

max :: QueryParam -> QueryParam -> QueryParam Source #

min :: QueryParam -> QueryParam -> QueryParam Source #

Hashable QueryParam Source # | Since: 0.3.5.0
Instance details Defined in Text.URI.Types Methods hashWithSalt :: Int -> QueryParam -> Int Source # hash :: QueryParam -> Int Source #
Lift QueryParam Source # | Since: 0.3.1.0
Instance details Defined in Text.URI.Types Methods lift :: Quote m => QueryParam -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => QueryParam -> Code m QueryParam Source #
type Rep QueryParam Source # |

Instance details

Defined in Text.URI.Types

type Rep QueryParam = D1 ('MetaData "QueryParam" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "QueryFlag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'QueryKey))) :+: C1 ('MetaCons "QueryParam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'QueryKey)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RText 'QueryValue))))

newtype ParseException Source #

Parse exception thrown by `mkURI` when a given `Text` value cannot be parsed as a `URI`.

Constructors

ParseException (ParseErrorBundle Text Void) | Arguments are: original input and parse error

#### Instances

Instances details

NFData ParseException Source # |
Instance details Defined in Text.URI.Types Methods rnf :: ParseException -> () Source #
Data ParseException Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: ParseException -> Constr Source #

dataTypeOf :: ParseException -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Exception ParseException Source # |
Instance details Defined in Text.URI.Types Methods toException :: ParseException -> SomeException Source # fromException :: SomeException -> Maybe ParseException Source # displayException :: ParseException -> String Source # backtraceDesired :: ParseException -> Bool Source #
Generic ParseException Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep ParseException |
Instance details Defined in Text.URI.Types type Rep ParseException = D1 ('MetaData "ParseException" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'True) (C1 ('MetaCons "ParseException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ParseErrorBundle Text Void))))

Methods

from :: ParseException -> Rep ParseException x Source #

to :: Rep ParseException x -> ParseException Source #

Show ParseException Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> ParseException -> ShowS Source # show :: ParseException -> String Source # showList :: [ParseException] -> ShowS Source #
Eq ParseException Source # |
Instance details Defined in Text.URI.Types Methods (==) :: ParseException -> ParseException -> Bool Source # (/=) :: ParseException -> ParseException -> Bool Source #
type Rep ParseException Source # |
Instance details Defined in Text.URI.Types type Rep ParseException = D1 ('MetaData "ParseException" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'True) (C1 ('MetaCons "ParseException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ParseErrorBundle Text Void))))

newtype ParseExceptionBs Source #

Parse exception thrown by `mkURIBs` when a given `ByteString` value cannot be parsed as a `URI`.

Since: 0.3.3.0

Constructors

ParseExceptionBs (ParseErrorBundle ByteString Void) | Arguments are: original input and parse error

#### Instances

Instances details

NFData ParseExceptionBs Source # |
Instance details Defined in Text.URI.Types Methods rnf :: ParseExceptionBs -> () Source #
Data ParseExceptionBs Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: ParseExceptionBs -> Constr Source #

dataTypeOf :: ParseExceptionBs -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Exception ParseExceptionBs Source # |
Instance details Defined in Text.URI.Types Methods toException :: ParseExceptionBs -> SomeException Source # fromException :: SomeException -> Maybe ParseExceptionBs Source # displayException :: ParseExceptionBs -> String Source # backtraceDesired :: ParseExceptionBs -> Bool Source #
Generic ParseExceptionBs Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep ParseExceptionBs |
Instance details Defined in Text.URI.Types type Rep ParseExceptionBs = D1 ('MetaData "ParseExceptionBs" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'True) (C1 ('MetaCons "ParseExceptionBs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ParseErrorBundle ByteString Void))))

Methods

from :: ParseExceptionBs -> Rep ParseExceptionBs x Source #

to :: Rep ParseExceptionBs x -> ParseExceptionBs Source #

Show ParseExceptionBs Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> ParseExceptionBs -> ShowS Source # show :: ParseExceptionBs -> String Source # showList :: [ParseExceptionBs] -> ShowS Source #
Eq ParseExceptionBs Source # |
Instance details Defined in Text.URI.Types Methods (==) :: ParseExceptionBs -> ParseExceptionBs -> Bool Source # (/=) :: ParseExceptionBs -> ParseExceptionBs -> Bool Source #
type Rep ParseExceptionBs Source # |
Instance details Defined in Text.URI.Types type Rep ParseExceptionBs = D1 ('MetaData "ParseExceptionBs" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'True) (C1 ('MetaCons "ParseExceptionBs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ParseErrorBundle ByteString Void))))

# Refined text

Refined text values can only be created by using the smart constructors listed below, such as `mkScheme`. This eliminates the possibility of having an invalid component in `URI` which could invalidate the whole `URI`.

Note that the refined text `RText` type is labelled at the type level with `RTextLabel`s, which see.

When an invalid `Text` value is passed to a smart constructor, it rejects it by throwing the `RTextException`. Remember that the `Maybe` datatype is also an instance of `MonadThrow`, and so one could as well use the smart constructors in the `Maybe` monad.

data RText (l :: RTextLabel) Source #

Refined text labelled at the type level.

#### Instances

Instances details

Typeable l => Lift (RText l :: Type) Source # | Since: 0.3.1.0
Instance details Defined in Text.URI.Types Methods lift :: Quote m => RText l -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => RText l -> Code m (RText l) Source #
Arbitrary (RText 'Fragment) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'Fragment) Source # shrink :: RText 'Fragment -> [RText 'Fragment] Source #
Arbitrary (RText 'Host) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'Host) Source # shrink :: RText 'Host -> [RText 'Host] Source #
Arbitrary (RText 'Password) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'Password) Source # shrink :: RText 'Password -> [RText 'Password] Source #
Arbitrary (RText 'PathPiece) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'PathPiece) Source # shrink :: RText 'PathPiece -> [RText 'PathPiece] Source #
Arbitrary (RText 'QueryKey) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'QueryKey) Source # shrink :: RText 'QueryKey -> [RText 'QueryKey] Source #
Arbitrary (RText 'QueryValue) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'QueryValue) Source # shrink :: RText 'QueryValue -> [RText 'QueryValue] Source #
Arbitrary (RText 'Scheme) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'Scheme) Source # shrink :: RText 'Scheme -> [RText 'Scheme] Source #
Arbitrary (RText 'Username) Source # |
Instance details Defined in Text.URI.Types Methods arbitrary :: Gen (RText 'Username) Source # shrink :: RText 'Username -> [RText 'Username] Source #
NFData (RText l) Source # |
Instance details Defined in Text.URI.Types Methods rnf :: RText l -> () Source #
Typeable l => Data (RText l) Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: RText l -> Constr Source #

dataTypeOf :: RText l -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic (RText l) Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep (RText l) |
Instance details Defined in Text.URI.Types type Rep (RText l) = D1 ('MetaData "RText" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'True) (C1 ('MetaCons "RText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: RText l -> Rep (RText l) x Source #

to :: Rep (RText l) x -> RText l Source #

Show (RText l) Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> RText l -> ShowS Source # show :: RText l -> String Source # showList :: [RText l] -> ShowS Source #
Eq (RText l) Source # |
Instance details Defined in Text.URI.Types Methods (==) :: RText l -> RText l -> Bool Source # (/=) :: RText l -> RText l -> Bool Source #
Ord (RText l) Source # |
Instance details Defined in Text.URI.Types Methods compare :: RText l -> RText l -> Ordering Source # (<) :: RText l -> RText l -> Bool Source # (<=) :: RText l -> RText l -> Bool Source # (>) :: RText l -> RText l -> Bool Source # (>=) :: RText l -> RText l -> Bool Source # max :: RText l -> RText l -> RText l Source # min :: RText l -> RText l -> RText l Source #
Hashable (RText l) Source # | Since: 0.3.5.0
Instance details Defined in Text.URI.Types Methods hashWithSalt :: Int -> RText l -> Int Source # hash :: RText l -> Int Source #
type Rep (RText l) Source # |
Instance details Defined in Text.URI.Types type Rep (RText l) = D1 ('MetaData "RText" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'True) (C1 ('MetaCons "RText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data RTextLabel Source #

Refined text labels.

Constructors

Scheme | See `mkScheme`
Host | See `mkHost`
Username | See `mkUsername`
Password | See `mkPassword`
PathPiece | See `mkPathPiece`
QueryKey | See `mkQueryKey`
QueryValue | See `mkQueryValue`
Fragment | See `mkFragment`

#### Instances

Instances details

Data RTextLabel Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: RTextLabel -> Constr Source #

dataTypeOf :: RTextLabel -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic RTextLabel Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep RTextLabel |

Instance details

Defined in Text.URI.Types

type Rep RTextLabel = D1 ('MetaData "RTextLabel" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (((C1 ('MetaCons "Scheme" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Host" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Username" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Password" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "PathPiece" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "QueryKey" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "QueryValue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Fragment" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: RTextLabel -> Rep RTextLabel x Source #

to :: Rep RTextLabel x -> RTextLabel Source #

Show RTextLabel Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> RTextLabel -> ShowS Source # show :: RTextLabel -> String Source # showList :: [RTextLabel] -> ShowS Source #
Eq RTextLabel Source # |
Instance details Defined in Text.URI.Types Methods (==) :: RTextLabel -> RTextLabel -> Bool Source # (/=) :: RTextLabel -> RTextLabel -> Bool Source #
Ord RTextLabel Source # |

Instance details

Defined in Text.URI.Types

Methods

compare :: RTextLabel -> RTextLabel -> Ordering Source #

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

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

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

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

max :: RTextLabel -> RTextLabel -> RTextLabel Source #

min :: RTextLabel -> RTextLabel -> RTextLabel Source #

type Rep RTextLabel Source # |

Instance details

Defined in Text.URI.Types

type Rep RTextLabel = D1 ('MetaData "RTextLabel" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (((C1 ('MetaCons "Scheme" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Host" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Username" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Password" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "PathPiece" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "QueryKey" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "QueryValue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Fragment" 'PrefixI 'False) (U1 :: Type -> Type))))

mkScheme :: MonadThrow m => Text -> m (RText 'Scheme) Source #

Lift a `Text` value into ``RText` `Scheme``.

Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus `"+"`, period `"."`, or hyphen `"-"`.

This smart constructor performs normalization of valid schemes by converting them to lower case.

See also: https://tools.ietf.org/html/rfc3986#section-3.1

mkHost :: MonadThrow m => Text -> m (RText 'Host) Source #

Lift a `Text` value into ``RText` `Host``.

The host sub-component of authority is identified by an IP literal encapsulated within square brackets, an IPv4 address in dotted-decimal form, or a registered name.

This smart constructor performs normalization of valid hosts by converting them to lower case.

See also: https://tools.ietf.org/html/rfc3986#section-3.2.2

mkUsername :: MonadThrow m => Text -> m (RText 'Username) Source #

Lift a `Text` value into ``RText` `Username``.

This smart constructor does not perform any sort of normalization.

See also: https://tools.ietf.org/html/rfc3986#section-3.2.1

mkPassword :: MonadThrow m => Text -> m (RText 'Password) Source #

Lift a `Text` value into ``RText` `Password``.

This smart constructor does not perform any sort of normalization.

See also: https://tools.ietf.org/html/rfc3986#section-3.2.1

mkPathPiece :: MonadThrow m => Text -> m (RText 'PathPiece) Source #

Lift a `Text` value into ``RText` `PathPiece``.

This smart constructor does not perform any sort of normalization.

See also: https://tools.ietf.org/html/rfc3986#section-3.3

mkQueryKey :: MonadThrow m => Text -> m (RText 'QueryKey) Source #

Lift a `Text` value into `'RText `QueryKey``.

This smart constructor does not perform any sort of normalization.

See also: https://tools.ietf.org/html/rfc3986#section-3.4

mkQueryValue :: MonadThrow m => Text -> m (RText 'QueryValue) Source #

Lift a `Text` value into ``RText` `QueryValue``.

This smart constructor does not perform any sort of normalization.

See also: https://tools.ietf.org/html/rfc3986#section-3.4

mkFragment :: MonadThrow m => Text -> m (RText 'Fragment) Source #

Lift a `Text` value into ``RText` `Fragment``.

This smart constructor does not perform any sort of normalization.

See also: https://tools.ietf.org/html/rfc3986#section-3.5

unRText :: forall (l :: RTextLabel). RText l -> Text Source #

Project a plain strict `Text` value from a refined ``RText` l` value.

data RTextException Source #

The exception is thrown when a refined ``RText` l` value cannot be constructed due to the fact that given `Text` value is not correct.

Constructors

RTextException RTextLabel Text | `RTextLabel` identifying what sort of refined text value could not be constructed and the input that was supplied, as a `Text` value

#### Instances

Instances details

Data RTextException Source # |

Instance details

Defined in Text.URI.Types

Methods

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

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

toConstr :: RTextException -> Constr Source #

dataTypeOf :: RTextException -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Exception RTextException Source # |
Instance details Defined in Text.URI.Types Methods toException :: RTextException -> SomeException Source # fromException :: SomeException -> Maybe RTextException Source # displayException :: RTextException -> String Source # backtraceDesired :: RTextException -> Bool Source #
Generic RTextException Source # |

Instance details

Defined in Text.URI.Types

Associated Types

type Rep RTextException |

Instance details

Defined in Text.URI.Types

type Rep RTextException = D1 ('MetaData "RTextException" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "RTextException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RTextLabel) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: RTextException -> Rep RTextException x Source #

to :: Rep RTextException x -> RTextException Source #

Show RTextException Source # |
Instance details Defined in Text.URI.Types Methods showsPrec :: Int -> RTextException -> ShowS Source # show :: RTextException -> String Source # showList :: [RTextException] -> ShowS Source #
Eq RTextException Source # |
Instance details Defined in Text.URI.Types Methods (==) :: RTextException -> RTextException -> Bool Source # (/=) :: RTextException -> RTextException -> Bool Source #
Ord RTextException Source # |

Instance details

Defined in Text.URI.Types

Methods

compare :: RTextException -> RTextException -> Ordering Source #

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

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

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

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

max :: RTextException -> RTextException -> RTextException Source #

min :: RTextException -> RTextException -> RTextException Source #

type Rep RTextException Source # |

Instance details

Defined in Text.URI.Types

type Rep RTextException = D1 ('MetaData "RTextException" "Text.URI.Types" "modern-uri-0.3.6.1-FqpgbF3IDDm5V9PWItMI9c" 'False) (C1 ('MetaCons "RTextException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RTextLabel) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

# Parsing

The input you feed into the parsers must be a valid URI as per RFC 3986, that is, its components should be percent-encoded where necessary.

parser :: MonadParsec e Text m => m URI Source #

This parser can be used to parse `URI` from strict `Text`. Remember to use a concrete non-polymorphic parser type for efficiency.

parserBs :: MonadParsec e ByteString m => m URI Source #

This parser can be used to parse `URI` from strict `ByteString`. Remember to use a concrete non-polymorphic parser type for efficiency.

Since: 0.0.2.0

# Rendering

Rendering functions take care of constructing correct `URI` representation as per RFC 3986, that is, percent-encoding will be applied when necessary automatically.

render :: URI -> Text Source #

Render a given `URI` value as strict `Text`.

render' :: URI -> Builder Source #

Render a given `URI` value as a `Builder`.

renderBs :: URI -> ByteString Source #

Render a given `URI` value as a strict `ByteString`.

renderBs' :: URI -> Builder Source #

Render a given `URI` value as a `Builder`.

renderStr :: URI -> String Source #

Render a given `URI` value as a `String`.

Since: 0.0.2.0

renderStr' :: URI -> ShowS Source #

Render a given `URI` value as `ShowS`.

Since: 0.0.2.0