IPv6Addr 1.1.5 → 2.0.0
raw patch · 2 files changed
+8/−14 lines, 2 filesdep ~randomPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: random
API changes (from Hackage documentation)
- Text.IPv6Addr: fromIPv6Addr :: IPv6Addr -> Text
Files
- IPv6Addr.cabal +4/−4
- Text/IPv6Addr.hs +4/−10
IPv6Addr.cabal view
@@ -1,5 +1,5 @@ name: IPv6Addr-version: 1.1.5+version: 2.0.0 synopsis: Library to deal with IPv6 address text representations. description: Library to deal with IPv6 address text representations, canonization and manipulations. homepage: https://github.com/MichelBoucey/IPv6Addr@@ -7,13 +7,13 @@ license-file: LICENSE author: Michel Boucey maintainer: michel.boucey@gmail.com-copyright: (c) 2011-2020 - Michel Boucey+copyright: (c) 2011-2021 - Michel Boucey category: Network build-type: Simple extra-source-files: README.md cabal-version: >=1.10 -Tested-With: GHC ==8.4.4 || ==8.6.5 || ==8.8.3 || ==8.10.1+Tested-With: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.1 || ==8.10.4 || ==9.0.1 Source-Repository head Type: git@@ -26,7 +26,7 @@ , text >=1.1 && < 1.3 , iproute >=1.3 && < 1.8 , network >=2.5 && < 4- , random >=1.0 && <= 1.2+ , random >=1.0 && < 1.3 , attoparsec >=0.12 && < 0.14 , aeson >= 0.8.0.2 && < 1.6 , network-info >=0.2 && <=0.3
Text/IPv6Addr.hs view
@@ -9,7 +9,6 @@ , sameIPv6Addr -- * Conversions- , fromIPv6Addr , toIPv6 , toHostName , toIP6ARPA@@ -37,7 +36,6 @@ import Data.List (elemIndex, elemIndices, group, intersperse, isSuffixOf) import Data.Maybe (fromJust, isJust)-import Data.Monoid ((<>)) import qualified Data.Text as T import qualified Data.Text.Read as R (decimal) @@ -51,14 +49,14 @@ import Numeric (showHex) import System.Random (randomRIO) -newtype IPv6Addr = IPv6Addr T.Text+newtype IPv6Addr = IPv6Addr { unIPv6Addr :: T.Text } instance Show IPv6Addr where show (IPv6Addr a) = T.unpack a instance Eq IPv6Addr where (==) (IPv6Addr a) (IPv6Addr b) =- show (maybePureIPv6Addr a) == show (maybePureIPv6Addr b)+ (unIPv6Addr <$> maybePureIPv6Addr a) == (unIPv6Addr <$> maybePureIPv6Addr b) instance ToJSON IPv6Addr where toJSON (IPv6Addr a) = String a@@ -118,7 +116,7 @@ -- toIP6ARPA :: IPv6Addr -> T.Text toIP6ARPA a =- T.reverse (T.concatMap go $ fromIPv6Addr $ fromJust $ maybeFullIPv6Addr $ fromIPv6Addr a) <> "IP6.ARPA."+ T.reverse (T.concatMap go $ unIPv6Addr $ fromJust $ maybeFullIPv6Addr $ unIPv6Addr a) <> "IP6.ARPA." where go ':' = T.empty go c = "." <> T.pack [c]@@ -129,7 +127,7 @@ -- toUNC :: IPv6Addr -> T.Text toUNC a =- T.concatMap go (fromIPv6Addr $ fromJust $ maybePureIPv6Addr $ fromIPv6Addr a) <> ".ipv6-literal.net"+ T.concatMap go (unIPv6Addr $ fromJust $ maybePureIPv6Addr $ unIPv6Addr a) <> ".ipv6-literal.net" where go ':' = "-" go c = T.pack [c]@@ -285,10 +283,6 @@ -- ------------------------------------------------------------------------- -- -- Internals -- -- ------------------------------------------------------------------------- ------ | Returns the 'T.Text' of an IPv6 address.-fromIPv6Addr :: IPv6Addr -> T.Text-fromIPv6Addr (IPv6Addr t) = t -- | Given an arbitrary list of 'IPv6AddrToken', returns the corresponding 'T.Text'. ipv6TokensToText :: [IPv6AddrToken] -> T.Text