serokell-util 0.1.3.0 → 0.1.3.1
raw patch · 2 files changed
+13/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
serokell-util.cabal view
@@ -1,5 +1,5 @@ name: serokell-util-version: 0.1.3.0+version: 0.1.3.1 synopsis: General-purpose functions by Serokell homepage: https://github.com/serokell/serokell-util license: MIT
src/Serokell/Util/Parse/Network.hs view
@@ -11,9 +11,11 @@ , host' , connection , connection'+ , recipient ) where import Control.Monad (liftM, void)+import Data.Monoid ((<>)) import Data.Word (Word16) import Serokell.Util.Parse.Common (Parser, asciiAlphaNum, byte, countMinMax, limitedInt)@@ -105,9 +107,6 @@ void $ char ']' return ipv6 -connection :: Parser (String, Maybe Word16)-connection = (\(h, p) -> (hostAddress h, p)) <$> connection'- connection' :: Parser (Host, Maybe Word16) connection' = do addr <- host'@@ -115,3 +114,13 @@ return (addr, p) where maybePort = option Nothing $ char ':' >> Just <$> port++connection :: Parser (String, Maybe Word16)+connection = (\(h, p) -> (hostAddress h, p)) <$> connection'++-- | 'Parser' for host with both hostname and port.+-- Example: 54.122.0.255:9999+recipient :: Parser (String, Word16)+recipient = connection >>= \(h, mp) -> case mp of+ Just p -> pure (h, p)+ _ -> fail $ "No port specified for host " <> h