Text.URI.Lens

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.Lens

Description

Lenses for working with the `URI` data type and its internals.

Synopsis

- uriScheme :: Lens' URI (Maybe (RText 'Scheme))
- uriAuthority :: Lens' URI (Either Bool Authority)
- uriPath :: Lens' URI [RText 'PathPiece]
- isPathAbsolute :: Getter URI Bool
- uriTrailingSlash :: Traversal' URI Bool
- uriQuery :: Lens' URI [QueryParam]
- uriFragment :: Lens' URI (Maybe (RText 'Fragment))
- authUserInfo :: Lens' Authority (Maybe UserInfo)
- authHost :: Lens' Authority (RText 'Host)
- authPort :: Lens' Authority (Maybe Word)
- uiUsername :: Lens' UserInfo (RText 'Username)
- uiPassword :: Lens' UserInfo (Maybe (RText 'Password))
- _QueryFlag :: Prism' QueryParam (RText 'QueryKey)
- _QueryParam :: Prism' QueryParam (RText 'QueryKey, RText 'QueryValue)
- queryFlag :: RText 'QueryKey -> Getter [QueryParam] Bool
- queryParam :: RText 'QueryKey -> Traversal' [QueryParam] (RText 'QueryValue)
- unRText :: forall (l :: RTextLabel) f. (Contravariant f, Functor f) => (Text -> f Text) -> RText l -> f (RText l)

# Documentation

uriScheme :: Lens' URI (Maybe (RText 'Scheme)) #

`URI` scheme lens.

uriAuthority :: Lens' URI (Either Bool Authority) #

`URI` authority lens.

Note: before version 0.1.0.0 this lens allowed to focus on ``Maybe` `Authority``.

uriPath :: Lens' URI [RText 'PathPiece] #

`URI` path lens.

isPathAbsolute :: Getter URI Bool #

A getter that can tell if path component of a `URI` is absolute.

Since: 0.1.0.0

uriTrailingSlash :: Traversal' URI Bool #

A 0-1 traversal allowing to view and manipulate trailing slash.

Since: 0.2.0.0

uriQuery :: Lens' URI [QueryParam] #

`URI` query params lens.

uriFragment :: Lens' URI (Maybe (RText 'Fragment)) #

`URI` fragment lens.

authUserInfo :: Lens' Authority (Maybe UserInfo) #

`Authority` user info lens.

authHost :: Lens' Authority (RText 'Host) #

`Authority` host lens.

authPort :: Lens' Authority (Maybe Word) #

`Authority` port lens.

uiUsername :: Lens' UserInfo (RText 'Username) #

`UserInfo` username lens.

uiPassword :: Lens' UserInfo (Maybe (RText 'Password)) #

`UserInfo` password lens.

_QueryFlag :: Prism' QueryParam (RText 'QueryKey) #

`QueryParam` prism for query flags.

_QueryParam :: Prism' QueryParam (RText 'QueryKey, RText 'QueryValue) #

`QueryParam` prism for query parameters.

queryFlag :: RText 'QueryKey -> Getter [QueryParam] Bool #

Check if the given query key is present in the collection of query parameters.

queryParam :: RText 'QueryKey -> Traversal' [QueryParam] (RText 'QueryValue) #

Manipulate a query parameter by its key. Note that since there may be several query parameters with the same key this is a traversal that can return/modify several items at once.

unRText :: forall (l :: RTextLabel) f. (Contravariant f, Functor f) => (Text -> f Text) -> RText l -> f (RText l) #

A getter that can project `Text` from refined text values.