Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- isIPv4Address :: String -> Bool
- isIPv6Address :: String -> Bool
- hostAndPort :: String -> Either String (String, Maybe String)
- maybeHostAndPort :: String -> Maybe (String, Maybe String)
- defaultHostAndPort :: String -> String -> Maybe (String, String)
Documentation
isIPv4Address :: String -> Bool Source
This function will validate ipv4 address and return True if string is valie adress
isIPv6Address :: String -> Bool Source
Function validates ipv6 address
maybeHostAndPort :: String -> Maybe (String, Maybe String) Source
Function will parse argument and return Maybe (Host, Maybe Port)
Examples:
>>>
maybeHostAndPort "192.168.10.12"
Just ("192.168.10.12",Nothing)>>>
maybeHostAndPort "192.168.10.12:7272"
Just ("192.168.10.12",Just "7272")
Function will take default port and connection string and returns Just (Host, Port) for valid input and Nothing for invalid.
Examples:
>>>
defaultHostAndPort "22" "my.server.com"
Just ("my.server.com","22")>>>
defaultHostAndPort "22" "my.otherserver.com:54022"
Just ("my.otherserver.com","54022")>>>
defaultHostAndPort "22" "porttobig.com:500022"
Nothing