ip-1.0.0: Library for IP and MAC addresses

Safe HaskellNone
LanguageHaskell2010

Net.IP

Contents

Synopsis

Pattern Matching

case_ :: (IPv4 -> a) -> (IPv6 -> a) -> IP -> a Source #

ipv4 :: IP -> Maybe IPv4 Source #

If the address is an IPv4 address, return the address.

ipv6 :: IP -> Maybe IPv6 Source #

If the address is an IPv6 address, and if it is not an IPv4-mapped IPv6 address, return the address.

Construction

Textual Conversion

Text

Types

newtype IP Source #

A 32-bit IPv4 address or a 128-bit IPv6 address. Internally, this is just represented as an IPv6 address. The functions provided in Net.IP help simulate constructing and pattern matching on values of this type. All functions and typeclass methods that convert IP values to text will display it as an IPv4 address if possible.

Constructors

IP 

Fields

Instances

Eq IP Source # 

Methods

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

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

Ord IP Source # 

Methods

compare :: IP -> IP -> Ordering #

(<) :: IP -> IP -> Bool #

(<=) :: IP -> IP -> Bool #

(>) :: IP -> IP -> Bool #

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

max :: IP -> IP -> IP #

min :: IP -> IP -> IP #

Read IP Source # 
Show IP Source # 

Methods

showsPrec :: Int -> IP -> ShowS #

show :: IP -> String #

showList :: [IP] -> ShowS #

FromJSON IP Source # 
ToJSON IP Source #