| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Pythia.Services.Types.Network
Description
Provides common network types.
Since: 0.1
Synopsis
- data IpType
- newtype IpAddress a = MkIpAddress {
- unIpAddress :: Refined (IpRefinement a) Text
- newtype IpAddresses a = MkIpAddresses {
- unIpAddresses :: [IpAddress a]
- type family IpRefinement a where ...
- data Ipv4Refinement
- data Ipv6Refinement
- newtype Device = MkDevice {}
- _Ipv4 :: Prism' IpType ()
- _Ipv6 :: Prism' IpType ()
IP Types
IP types.
Since: 0.1
Type for an IP address. The type family IpRefinement refines the
underlying Text according to the spec.
Ipv4: All characters are digits or dots, and the length is0 < l < 16.Ipv6: All characters are hex digits or colons, and the length is0 < l < 40.
Since: 0.1
Constructors
| MkIpAddress | |
Fields
| |
Instances
| (k ~ An_Iso, a ~ Refined (IpRefinement s) Text, b ~ Refined (IpRefinement s) Text) => LabelOptic "unIpAddress" k (IpAddress s) (IpAddress s) a b Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| Generic (IpAddress a) Source # | |
| Show (IpAddress a) Source # | Since: 0.1 |
| NFData (IpAddress a) Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| Eq (IpAddress a) Source # | Since: 0.1 |
| Ord (IpAddress a) Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| Display (IpAddress a) Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| type Rep (IpAddress a) Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network type Rep (IpAddress a) = D1 ('MetaData "IpAddress" "Pythia.Services.Types.Network" "pythia-0.1-inplace" 'True) (C1 ('MetaCons "MkIpAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "unIpAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Refined (IpRefinement a) Text)))) | |
newtype IpAddresses a Source #
Since: 0.1
Constructors
| MkIpAddresses | |
Fields
| |
Instances
Refinements
type family IpRefinement a where ... Source #
Equations
| IpRefinement Ipv4 = Ipv4Refinement | |
| IpRefinement Ipv6 = Ipv6Refinement |
data Ipv4Refinement Source #
IPv4 Refinement. We implement a custom type here so we get better error
messages. Text must satisfy:
- Length in
(0, 16). - Chars are all decimal digits or dots.
Examples
>>>R.refine @Ipv4Refinement @Text "192.168.1.2"Right (Refined "192.168.1.2")
>>>trim $ R.refine @Ipv4Refinement @Text """Left The predicate (Ipv4Refinement) failed with the message: Expected IPv4 with length (0, 16). Received empty."
>>>trim $ R.refine @Ipv4Refinement @Text "192.168.111.222.7""Left The predicate (Ipv4Refinement) failed with the message: Expected IPv4 address with length (0, 16). Received '192.168.111.222.7' of length 17"
>>>trim $ R.refine @Ipv4Refinement @Text "192.168x1.2""Left The predicate (Ipv4Refinement) failed with the message: IPv4 address should only contain decimal digits or dots. Received invalid: 192.168x1.2"
Since: 0.1
Instances
| Predicate Ipv4Refinement Text Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network Methods validate :: Proxy Ipv4Refinement -> Text -> Maybe RefineException Source # | |
data Ipv6Refinement Source #
IPv6 Refinement. We implement a custom type here so we get better error
messages. Text must satisfy:
- Length in
(0, 40). - Chars are all hex digits or colons.
Examples
>>>R.refine @Ipv6Refinement @Text "fe80::a328:482:5263:10b8"Right (Refined "fe80::a328:482:5263:10b8")
>>>trim $ R.refine @Ipv6Refinement @Text """Left The predicate (Ipv6Refinement) failed with the message: Expected IPv6 of length (0, 40). Received empty."
>>>trim $ R.refine @Ipv6Refinement @Text "fe80:a328:4822:5263:10b8:4062:10d3:16ac:""Left The predicate (Ipv6Refinement) failed with the message: Expected IPv6 with length (0, 40). Received 'fe80:a328:4822:5263:10b8:4062:10d3:16ac:' of length 40"
>>>trim $ R.refine @Ipv6Refinement @Text "fe80::a328:482:5263:10b8x""Left The predicate (Ipv6Refinement) failed with the message: IPv6 address should only contain hex digits or colons. Received invalid: fe80::a328:482:5263:10b8x"
Since: 0.1
Instances
| Predicate Ipv6Refinement Text Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network Methods validate :: Proxy Ipv6Refinement -> Text -> Maybe RefineException Source # | |
Network Device
Newtype wrapper over a network device name.
Since: 0.1
Instances
| IsString Device Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network Methods fromString :: String -> Device # | |
| Generic Device Source # | |
| Read Device Source # | Since: 0.1 |
| Show Device Source # | Since: 0.1 |
| NFData Device Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| Eq Device Source # | Since: 0.1 |
| Ord Device Source # | Since: 0.1 |
| Display Device Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| (k ~ An_Iso, a ~ Text, b ~ Text) => LabelOptic "unDevice" k Device Device a b Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |
| type Rep Device Source # | Since: 0.1 |
Defined in Pythia.Services.Types.Network | |