Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Iri.Data
Contents
Synopsis
- data Iri = Iri !Scheme !Hierarchy !Query !Fragment
- newtype Scheme = Scheme ByteString
- data Hierarchy
- data Authority = Authority !UserInfo !Host !Port
- data UserInfo
- newtype User = User ByteString
- data Password
- data Host
- newtype RegName = RegName (Vector DomainLabel)
- data DomainLabel = DomainLabel Text
- data Port
- newtype Path = Path (Vector PathSegment)
- newtype PathSegment = PathSegment ByteString
- newtype Query = Query ByteString
- newtype Fragment = Fragment ByteString
- data HttpIri = HttpIri !Security !Host !Port !Path !Query !Fragment
- newtype Security = Security Bool
- httpIriFromIri :: Iri -> Either Text HttpIri
- iriFromHttpIri :: HttpIri -> Iri
Documentation
Thorough structure of IRI or URI.
Instances
Generic Iri Source # | |
Show Iri Source # | |
Eq Iri Source # | |
Ord Iri Source # | |
Hashable Iri Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Iri Source # | |
type Rep Iri Source # | |
Defined in Iri.Data.Instances.Generic type Rep Iri = D1 ('MetaData "Iri" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "Iri" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Scheme) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Hierarchy)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Query) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Fragment)))) |
Constructors
Scheme ByteString |
Instances
Generic Scheme Source # | |
Show Scheme Source # | |
Eq Scheme Source # | |
Ord Scheme Source # | |
Hashable Scheme Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Scheme Source # | |
type Rep Scheme Source # | |
Defined in Iri.Data.Instances.Generic type Rep Scheme = D1 ('MetaData "Scheme" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'True) (C1 ('MetaCons "Scheme" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
Constructors
AuthorisedHierarchy !Authority !Path | |
AbsoluteHierarchy !Path | |
RelativeHierarchy !Path |
Instances
Generic Hierarchy Source # | |
Show Hierarchy Source # | |
Eq Hierarchy Source # | |
Ord Hierarchy Source # | |
Hashable Hierarchy Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Hierarchy Source # | |
type Rep Hierarchy Source # | |
Defined in Iri.Data.Instances.Generic type Rep Hierarchy = D1 ('MetaData "Hierarchy" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "AuthorisedHierarchy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Authority) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Path)) :+: (C1 ('MetaCons "AbsoluteHierarchy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Path)) :+: C1 ('MetaCons "RelativeHierarchy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Path)))) |
Instances
Generic Authority Source # | |
Show Authority Source # | |
Eq Authority Source # | |
Ord Authority Source # | |
Hashable Authority Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Authority Source # | |
type Rep Authority Source # | |
Defined in Iri.Data.Instances.Generic type Rep Authority = D1 ('MetaData "Authority" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "Authority" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UserInfo) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Host) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Port)))) |
Constructors
PresentUserInfo !User !Password | |
MissingUserInfo |
Instances
Generic UserInfo Source # | |
Show UserInfo Source # | |
Eq UserInfo Source # | |
Ord UserInfo Source # | |
Defined in Iri.Data.Instances.Ord | |
Hashable UserInfo Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift UserInfo Source # | |
type Rep UserInfo Source # | |
Defined in Iri.Data.Instances.Generic type Rep UserInfo = D1 ('MetaData "UserInfo" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "PresentUserInfo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 User) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Password)) :+: C1 ('MetaCons "MissingUserInfo" 'PrefixI 'False) (U1 :: Type -> Type)) |
Constructors
User ByteString |
Instances
Generic User Source # | |
Show User Source # | |
Eq User Source # | |
Ord User Source # | |
Hashable User Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift User Source # | |
type Rep User Source # | |
Defined in Iri.Data.Instances.Generic type Rep User = D1 ('MetaData "User" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'True) (C1 ('MetaCons "User" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
Constructors
PresentPassword !ByteString | |
MissingPassword |
Instances
Generic Password Source # | |
Show Password Source # | |
Eq Password Source # | |
Ord Password Source # | |
Defined in Iri.Data.Instances.Ord | |
Hashable Password Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Password Source # | |
type Rep Password Source # | |
Defined in Iri.Data.Instances.Generic type Rep Password = D1 ('MetaData "Password" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "PresentPassword" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "MissingPassword" 'PrefixI 'False) (U1 :: Type -> Type)) |
Instances
Generic Host Source # | |
Show Host Source # | |
Eq Host Source # | |
Ord Host Source # | |
Hashable Host Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Host Source # | |
type Rep Host Source # | |
Defined in Iri.Data.Instances.Generic type Rep Host = D1 ('MetaData "Host" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "NamedHost" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RegName)) :+: (C1 ('MetaCons "IpV4Host" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IPv4)) :+: C1 ('MetaCons "IpV6Host" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IPv6)))) |
Constructors
RegName (Vector DomainLabel) |
Instances
Generic RegName Source # | |
Show RegName Source # | |
Eq RegName Source # | |
Ord RegName Source # | |
Defined in Iri.Data.Instances.Ord | |
Hashable RegName Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift RegName Source # | |
type Rep RegName Source # | |
Defined in Iri.Data.Instances.Generic type Rep RegName = D1 ('MetaData "RegName" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'True) (C1 ('MetaCons "RegName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector DomainLabel)))) |
data DomainLabel Source #
Constructors
DomainLabel Text |
Instances
Constructors
PresentPort !Word16 | |
MissingPort |
Instances
Generic Port Source # | |
Show Port Source # | |
Eq Port Source # | |
Ord Port Source # | |
Hashable Port Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Port Source # | |
type Rep Port Source # | |
Defined in Iri.Data.Instances.Generic type Rep Port = D1 ('MetaData "Port" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'False) (C1 ('MetaCons "PresentPort" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :+: C1 ('MetaCons "MissingPort" 'PrefixI 'False) (U1 :: Type -> Type)) |
Constructors
Path (Vector PathSegment) |
Instances
Generic Path Source # | |
Show Path Source # | |
Eq Path Source # | |
Ord Path Source # | |
Hashable Path Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Path Source # | |
type Rep Path Source # | |
Defined in Iri.Data.Instances.Generic type Rep Path = D1 ('MetaData "Path" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'True) (C1 ('MetaCons "Path" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector PathSegment)))) |
newtype PathSegment Source #
Constructors
PathSegment ByteString |
Instances
Since the exact structure of the query string is not standardised and methods used to parse the query string may differ between websites, we simply represent it as percent-decoded bytes.
Constructors
Query ByteString |
Instances
Generic Query Source # | |
Show Query Source # | |
Eq Query Source # | |
Ord Query Source # | |
Hashable Query Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Query Source # | |
type Rep Query Source # | |
Defined in Iri.Data.Instances.Generic type Rep Query = D1 ('MetaData "Query" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'True) (C1 ('MetaCons "Query" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
Constructors
Fragment ByteString |
Instances
Generic Fragment Source # | |
Show Fragment Source # | |
Eq Fragment Source # | |
Ord Fragment Source # | |
Defined in Iri.Data.Instances.Ord | |
Hashable Fragment Source # | |
Defined in Iri.Data.Instances.Hashable | |
Lift Fragment Source # | |
type Rep Fragment Source # | |
Defined in Iri.Data.Instances.Generic type Rep Fragment = D1 ('MetaData "Fragment" "Iri.Data.Types" "iri-0.5.1.1-H6emllxMvLn58XoQNu4ebf" 'True) (C1 ('MetaCons "Fragment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
Special cases
HTTP special case
HTTP being by far the most common use-case for resource identifiers, it's been isolated into a dedicated data-type, which is optimised for that particular case.
Compared to the general URI definition it:
- only supports the HTTP and HTTPS schemes
- misses the Username and Password components
- requires the Host component
- requires the Path component to be absolute
Instances
iriFromHttpIri :: HttpIri -> Iri Source #
Generalize an HTTP IRI to IRI