pythia-0.1: A utility program for retrieving system information.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Pythia.Services.Types.Network

Description

Provides common network types.

Since: 0.1

Synopsis

IP Types

data IpType Source #

IP types.

Since: 0.1

Constructors

Ipv4

Since: 0.1

Ipv6

Since: 0.1

Instances

Instances details
Generic IpType Source # 
Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Rep IpType :: Type -> Type #

Methods

from :: IpType -> Rep IpType x #

to :: Rep IpType x -> IpType #

Show IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

NFData IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

rnf :: IpType -> () #

Eq IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

(==) :: IpType -> IpType -> Bool #

(/=) :: IpType -> IpType -> Bool #

type Rep IpType Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep IpType = D1 ('MetaData "IpType" "Pythia.Services.Types.Network" "pythia-0.1-inplace" 'False) (C1 ('MetaCons "Ipv4" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Ipv6" 'PrefixI 'False) (U1 :: Type -> Type))

newtype IpAddress a Source #

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 is 0 < l < 16.
  • Ipv6: All characters are hex digits or colons, and the length is 0 < l < 40.

Since: 0.1

Constructors

MkIpAddress 

Fields

Instances

Instances details
(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

Instance details

Defined in Pythia.Services.Types.Network

Methods

labelOptic :: Optic k NoIx (IpAddress s) (IpAddress s) a b Source #

Generic (IpAddress a) Source # 
Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Rep (IpAddress a) :: Type -> Type #

Methods

from :: IpAddress a -> Rep (IpAddress a) x #

to :: Rep (IpAddress a) x -> IpAddress a #

Show (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

NFData (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

rnf :: IpAddress a -> () #

Eq (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

(==) :: IpAddress a -> IpAddress a -> Bool #

(/=) :: IpAddress a -> IpAddress a -> Bool #

Ord (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Display (IpAddress a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep (IpAddress a) Source #

Since: 0.1

Instance details

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

Instances details
(k ~ An_Iso, a ~ [IpAddress s], b ~ [IpAddress s]) => LabelOptic "unIpAddresses" k (IpAddresses s) (IpAddresses s) a b Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Monoid (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Semigroup (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Generic (IpAddresses a) Source # 
Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Rep (IpAddresses a) :: Type -> Type #

Methods

from :: IpAddresses a -> Rep (IpAddresses a) x #

to :: Rep (IpAddresses a) x -> IpAddresses a #

IsList (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Item (IpAddresses a) #

Show (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

NFData (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

rnf :: IpAddresses a -> () #

Eq (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Ord (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Display (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep (IpAddresses a) Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep (IpAddresses a) = D1 ('MetaData "IpAddresses" "Pythia.Services.Types.Network" "pythia-0.1-inplace" 'True) (C1 ('MetaCons "MkIpAddresses" 'PrefixI 'True) (S1 ('MetaSel ('Just "unIpAddresses") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [IpAddress a])))
type Item (IpAddresses a) Source # 
Instance details

Defined in Pythia.Services.Types.Network

Refinements

type family IpRefinement a where ... Source #

Maps IpType to its Text refinement.

Since: 0.1

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

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

Instances details
Predicate Ipv4Refinement Text Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

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

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

Instances details
Predicate Ipv6Refinement Text Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Network Device

newtype Device Source #

Newtype wrapper over a network device name.

Since: 0.1

Constructors

MkDevice 

Fields

Instances

Instances details
IsString Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

fromString :: String -> Device #

Generic Device Source # 
Instance details

Defined in Pythia.Services.Types.Network

Associated Types

type Rep Device :: Type -> Type #

Methods

from :: Device -> Rep Device x #

to :: Rep Device x -> Device #

Read Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Show Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

NFData Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

rnf :: Device -> () #

Eq Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Methods

(==) :: Device -> Device -> Bool #

(/=) :: Device -> Device -> Bool #

Ord Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

Display Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

(k ~ An_Iso, a ~ Text, b ~ Text) => LabelOptic "unDevice" k Device Device a b Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep Device Source #

Since: 0.1

Instance details

Defined in Pythia.Services.Types.Network

type Rep Device = D1 ('MetaData "Device" "Pythia.Services.Types.Network" "pythia-0.1-inplace" 'True) (C1 ('MetaCons "MkDevice" 'PrefixI 'True) (S1 ('MetaSel ('Just "unDevice") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Optics

_Ipv4 :: Prism' IpType () Source #

Since: 0.1

_Ipv6 :: Prism' IpType () Source #

Since: 0.1