debian-4.1.2: Modules for working with the Debian package system

Safe Haskell | None
Language | Haskell2010

Debian.URI

Contents

- String known to parsable by parseURIReference. Mainly
- Lift IO operations into a MonadError instance
- QuickCheck properties
- Orphan instances

Synopsis

- data URIAuth = URIAuth {
  - uriUserInfo :: String
  - uriRegName :: String
  - uriPort :: String
  }
- data URI = URI {
  - uriScheme :: String
  - uriAuthority :: Maybe URIAuth
  - uriPath :: String
  - uriQuery :: String
  - uriFragment :: String
  }
- nullURI :: URI
- parseURI :: String -> Maybe URI
- parseURIReference :: String -> Maybe URI
- parseRelativeReference :: String -> Maybe URI
- parseAbsoluteURI :: String -> Maybe URI
- uriToString :: (String -> String) -> URI -> ShowS
- data URIError
  - = URIParseError String String
  - | URIAppendError URI URI
- uriSchemeLens :: Lens' URI String
- uriAuthorityLens :: Lens' URI (Maybe URIAuth)
- uriPathLens :: Lens' URI String
- uriQueryLens :: Lens' URI String
- uriFragmentLens :: Lens' URI String
- newtype URI' = URI' String
- fromURI' :: URI' -> URI
- toURI' :: URI -> URI'
- readURI' :: String -> Maybe URI'
- showURI :: URI -> String
- parseURIReference' :: (HasURIError e, MonadError e m) => String -> m URI
- parseURI' :: (HasURIError e, MonadError e m) => String -> m URI
- parseAbsoluteURI' :: (HasURIError e, MonadError e m) => String -> m URI
- parseRelativeReference' :: (HasURIError e, MonadError e m) => String -> m URI
- parseURIUnsafe :: String -> URI
- appendURI :: MonadError URIError m => URI -> URI -> m URI
- appendURIs :: (Foldable t, MonadError URIError m) => t URI -> m URI
- parentURI :: URI -> URI
- uriToString' :: URI -> String
- class HasParseError e where
  - fromParseError :: ParseError -> e
- class HasURIError e where
  - fromURIError :: URIError -> e
- prop_print_parse :: URI -> Bool
- prop_append_singleton :: URI -> Bool

# Documentation

data URIAuth Source #

Type for authority value within a URI

Constructors

URIAuth |

Fields

- uriUserInfo :: String

      anonymous@

- uriRegName :: String

      www.haskell.org

- uriPort :: String

      :42

#### Instances

Instances details

NFData URIAuth |
Instance details Defined in Network.URI Methods rnf :: URIAuth -> () Source #
Data URIAuth |

Instance details

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 Source #

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

toConstr :: URIAuth -> Constr Source #

dataTypeOf :: URIAuth -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic URIAuth |

Instance details

Defined in Network.URI

Associated Types

type Rep URIAuth |

Instance details

Defined in Network.URI

type Rep URIAuth = D1 ('MetaData "URIAuth" "Network.URI" "network-uri-2.6.4.2-BXV0MtFcaF6BxSkElkpvb1" '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))))

Methods

from :: URIAuth -> Rep URIAuth x Source #

to :: Rep URIAuth x -> URIAuth Source #

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

Instance details

Defined in Network.URI

type Rep URIAuth = D1 ('MetaData "URIAuth" "Network.URI" "network-uri-2.6.4.2-BXV0MtFcaF6BxSkElkpvb1" '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))))

data URI Source #

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 |

Fields

- uriScheme :: String

      foo:

- uriAuthority :: Maybe URIAuth

      //anonymous@www.haskell.org:42

- uriPath :: String

      /ghc

- uriQuery :: String

      ?query

- uriFragment :: String

      #frag

#### Instances

Instances details

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

Instance details

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

Instance details

Defined in Network.URI

Associated Types

type Rep URI |

Instance details

Defined in Network.URI

type Rep URI = D1 ('MetaData "URI" "Network.URI" "network-uri-2.6.4.2-BXV0MtFcaF6BxSkElkpvb1" '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)))))

Methods

from :: URI -> Rep URI x Source #

to :: Rep URI x -> URI Source #

Show URI |
Instance details Defined in Network.URI Methods showsPrec :: Int -> URI -> ShowS Source # show :: URI -> String Source # showList :: [URI] -> ShowS Source #
Eq URI |
Instance details Defined in Network.URI Methods (==) :: URI -> URI -> Bool Source # (/=) :: URI -> URI -> Bool Source #
Ord URI |
Instance details Defined in Network.URI 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 #
Lift URI |
Instance details Defined in Network.URI Methods lift :: Quote m => URI -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => URI -> Code m URI Source #
type Rep URI |

Instance details

Defined in Network.URI

type Rep URI = D1 ('MetaData "URI" "Network.URI" "network-uri-2.6.4.2-BXV0MtFcaF6BxSkElkpvb1" '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)))))

nullURI :: URI Source #

Blank URI

parseURI :: String -> Maybe URI Source #

Turn a string containing a URI into a `URI`. Returns `Nothing` if the string is not a valid URI; (an absolute URI with optional fragment identifier).

NOTE: this is different from the previous network.URI, whose `parseURI` function works like `parseURIReference` in this module.

parseURIReference :: String -> Maybe URI Source #

Parse a URI reference to a `URI` value. Returns `Nothing` if the string is not a valid URI reference. (an absolute or relative URI with optional fragment identifier).

parseRelativeReference :: String -> Maybe URI Source #

Parse a relative URI to a `URI` value. Returns `Nothing` if the string is not a valid relative URI. (a relative URI with optional fragment identifier).

parseAbsoluteURI :: String -> Maybe URI Source #

Parse an absolute URI to a `URI` value. Returns `Nothing` if the string is not a valid absolute URI. (an absolute URI without a fragment identifier).

uriToString :: (String -> String) -> URI -> ShowS Source #

Turn a `URI` into a string.

Uses a supplied function to map the userinfo part of the URI.

The Show instance for URI uses a mapping that hides any password that may be present in the URI. Use this function with argument `id` to preserve the password in the formatted output.

data URIError Source #

Constructors

URIParseError String String |
URIAppendError URI URI |

#### Instances

Instances details

HasURIError URIError Source # |
Instance details Defined in Debian.URI Methods fromURIError :: URIError -> URIError Source #
Show URIError Source # |
Instance details Defined in Debian.URI Methods showsPrec :: Int -> URIError -> ShowS Source # show :: URIError -> String Source # showList :: [URIError] -> ShowS Source #
Eq URIError Source # |
Instance details Defined in Debian.URI Methods (==) :: URIError -> URIError -> Bool Source # (/=) :: URIError -> URIError -> Bool Source #
Ord URIError Source # |
Instance details Defined in Debian.URI Methods compare :: URIError -> URIError -> Ordering Source # (<) :: URIError -> URIError -> Bool Source # (<=) :: URIError -> URIError -> Bool Source # (>) :: URIError -> URIError -> Bool Source # (>=) :: URIError -> URIError -> Bool Source # max :: URIError -> URIError -> URIError Source # min :: URIError -> URIError -> URIError Source #

uriSchemeLens :: Lens' URI String Source #

uriAuthorityLens :: Lens' URI (Maybe URIAuth) Source #

uriPathLens :: Lens' URI String Source #

uriQueryLens :: Lens' URI String Source #

uriFragmentLens :: Lens' URI String Source #

# String known to parsable by parseURIReference. Mainly

newtype URI' Source #

A wrapper around a String containing a known parsable URI. Not absolutely safe, because you could say read "URI' "bogus string"" :: URI'. But enough to save me from myself.

Constructors

URI' String |

#### Instances

Instances details

Read URI' Source # |
Instance details Defined in Debian.URI Methods readsPrec :: Int -> ReadS URI' Source # readList :: ReadS [URI'] Source # readPrec :: ReadPrec URI' Source # readListPrec :: ReadPrec [URI'] Source #
Show URI' Source # |
Instance details Defined in Debian.URI Methods showsPrec :: Int -> URI' -> ShowS Source # show :: URI' -> String Source # showList :: [URI'] -> ShowS Source #
Eq URI' Source # |
Instance details Defined in Debian.URI Methods (==) :: URI' -> URI' -> Bool Source # (/=) :: URI' -> URI' -> Bool Source #
Ord URI' Source # |
Instance details Defined in Debian.URI 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 #

fromURI' :: URI' -> URI Source #

toURI' :: URI -> URI' Source #

Using the bogus Show instance of URI here. If it ever gets fixed this will stop working. Worth noting that show will obscure any password info embedded in the URI, so that's nice.

readURI' :: String -> Maybe URI' Source #

showURI :: URI -> String Source #

parseURIReference' :: (HasURIError e, MonadError e m) => String -> m URI Source #

parseURI' :: (HasURIError e, MonadError e m) => String -> m URI Source #

parseURI with MonadError

parseAbsoluteURI' :: (HasURIError e, MonadError e m) => String -> m URI Source #

parseRelativeReference' :: (HasURIError e, MonadError e m) => String -> m URI Source #

parseURIUnsafe :: String -> URI Source #

appendURI :: MonadError URIError m => URI -> URI -> m URI Source #

Conservative appending of absolute and relative URIs. There may be other cases that can be implemented, lets see if they turn up.

appendURIs :: (Foldable t, MonadError URIError m) => t URI -> m URI Source #

Append a list of URI @@ λ> appendURIs (parseURI "http://host.com") (parseURIRelative "/bar")

parentURI :: URI -> URI Source #

uriToString' :: URI -> String Source #

# Lift IO operations into a MonadError instance

class HasParseError e where Source #

Methods

fromParseError :: ParseError -> e Source #

#### Instances

Instances details

HasParseError ParseError Source # |
Instance details Defined in Debian.URI Methods fromParseError :: ParseError -> ParseError Source #

class HasURIError e where Source #

Methods

fromURIError :: URIError -> e Source #

#### Instances

Instances details

HasURIError URIError Source # |
Instance details Defined in Debian.URI Methods fromURIError :: URIError -> URIError Source #

# QuickCheck properties

prop_print_parse :: URI -> Bool Source #

prop_append_singleton :: URI -> Bool Source #

# Orphan instances

Ord ParseError Source # |
Instance details Methods compare :: ParseError -> ParseError -> Ordering Source # (<) :: ParseError -> ParseError -> Bool Source # (<=) :: ParseError -> ParseError -> Bool Source # (>) :: ParseError -> ParseError -> Bool Source # (>=) :: ParseError -> ParseError -> Bool Source # max :: ParseError -> ParseError -> ParseError Source # min :: ParseError -> ParseError -> ParseError Source #