| Safe Haskell | None |
|---|---|
| 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
| Eq Iri Source # | |
| Ord Iri Source # | |
| Show Iri Source # | |
| Generic Iri Source # | |
| Lift Iri Source # | |
| Hashable Iri Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Iri Source # | |
Defined in Iri.Data.Instances.Generic type Rep Iri = D1 (MetaData "Iri" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Scheme Source # | |
| Ord Scheme Source # | |
| Show Scheme Source # | |
| Generic Scheme Source # | |
| Lift Scheme Source # | |
| Hashable Scheme Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Scheme Source # | |
Defined in Iri.Data.Instances.Generic type Rep Scheme = D1 (MetaData "Scheme" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Hierarchy Source # | |
| Ord Hierarchy Source # | |
| Show Hierarchy Source # | |
| Generic Hierarchy Source # | |
| Lift Hierarchy Source # | |
| Hashable Hierarchy Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Hierarchy Source # | |
Defined in Iri.Data.Instances.Generic type Rep Hierarchy = D1 (MetaData "Hierarchy" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Authority Source # | |
| Ord Authority Source # | |
| Show Authority Source # | |
| Generic Authority Source # | |
| Lift Authority Source # | |
| Hashable Authority Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Authority Source # | |
Defined in Iri.Data.Instances.Generic type Rep Authority = D1 (MetaData "Authority" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq UserInfo Source # | |
| Ord UserInfo Source # | |
Defined in Iri.Data.Instances.Ord | |
| Show UserInfo Source # | |
| Generic UserInfo Source # | |
| Lift UserInfo Source # | |
| Hashable UserInfo Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep UserInfo Source # | |
Defined in Iri.Data.Instances.Generic type Rep UserInfo = D1 (MetaData "UserInfo" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq User Source # | |
| Ord User Source # | |
| Show User Source # | |
| Generic User Source # | |
| Lift User Source # | |
| Hashable User Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep User Source # | |
Defined in Iri.Data.Instances.Generic type Rep User = D1 (MetaData "User" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" True) (C1 (MetaCons "User" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString))) | |
Constructors
| PresentPassword !ByteString | |
| MissingPassword |
Instances
| Eq Password Source # | |
| Ord Password Source # | |
Defined in Iri.Data.Instances.Ord | |
| Show Password Source # | |
| Generic Password Source # | |
| Lift Password Source # | |
| Hashable Password Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Password Source # | |
Defined in Iri.Data.Instances.Generic type Rep Password = D1 (MetaData "Password" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Host Source # | |
| Ord Host Source # | |
| Show Host Source # | |
| Generic Host Source # | |
| Lift Host Source # | |
| Hashable Host Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Host Source # | |
Defined in Iri.Data.Instances.Generic type Rep Host = D1 (MetaData "Host" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq RegName Source # | |
| Ord RegName Source # | |
Defined in Iri.Data.Instances.Ord | |
| Show RegName Source # | |
| Generic RegName Source # | |
| Lift RegName Source # | |
| Hashable RegName Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep RegName Source # | |
Defined in Iri.Data.Instances.Generic type Rep RegName = D1 (MetaData "RegName" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Port Source # | |
| Ord Port Source # | |
| Show Port Source # | |
| Generic Port Source # | |
| Lift Port Source # | |
| Hashable Port Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Port Source # | |
Defined in Iri.Data.Instances.Generic type Rep Port = D1 (MetaData "Port" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Path Source # | |
| Ord Path Source # | |
| Show Path Source # | |
| Generic Path Source # | |
| Lift Path Source # | |
| Hashable Path Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Path Source # | |
Defined in Iri.Data.Instances.Generic type Rep Path = D1 (MetaData "Path" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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
| Eq Query Source # | |
| Ord Query Source # | |
| Show Query Source # | |
| Generic Query Source # | |
| Lift Query Source # | |
| Hashable Query Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Query Source # | |
Defined in Iri.Data.Instances.Generic type Rep Query = D1 (MetaData "Query" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" True) (C1 (MetaCons "Query" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString))) | |
Constructors
| Fragment ByteString |
Instances
| Eq Fragment Source # | |
| Ord Fragment Source # | |
Defined in Iri.Data.Instances.Ord | |
| Show Fragment Source # | |
| Generic Fragment Source # | |
| Lift Fragment Source # | |
| Hashable Fragment Source # | |
Defined in Iri.Data.Instances.Hashable | |
| type Rep Fragment Source # | |
Defined in Iri.Data.Instances.Generic type Rep Fragment = D1 (MetaData "Fragment" "Iri.Data.Types" "iri-0.4-6utNI10Cmpx1Ay6lBJs6Kb" 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