@@ -55,8 +55,13 @@ import qualified Data.ByteString.Char8 as BC
5555import qualified Data.ByteString.Lazy as LB
5656import Data.Data
5757import Data.Either (rights , lefts )
58- import Data.List (intersperse , foldl' )
59- import Data.Monoid
58+ import Data.List (intersperse )
59+ #if !MIN_VERSION_base(4,20,0)
60+ import Data.List (foldl' )
61+ #endif
62+ #if !MIN_VERSION_base(4,11,0)
63+ import Data.Semigroup ((<>) )
64+ #endif
6065import GHC.Generics
6166import System.Environment
6267import System.IO.Error
@@ -142,12 +147,7 @@ netRcToBuilder (NetRc ms ds) =
142147--
143148-- This is currently just a convenience wrapper around 'netRcToBuilder'
144149netRcToByteString :: NetRc -> ByteString
145- #if MIN_VERSION_bytestring(0,10,0)
146150netRcToByteString = LB. toStrict . BB. toLazyByteString . netRcToBuilder
147- #else
148- netRcToByteString = B. concat . LB. toChunks . BB. toLazyByteString . netRcToBuilder
149- #endif
150-
151151
152152-- | Convenience wrapper for 'netRcParsec' parser
153153--
@@ -163,7 +163,6 @@ netRcToByteString = B.concat . LB.toChunks . BB.toLazyByteString . netRcToBuilde
163163parseNetRc :: P. SourceName -> ByteString -> Either P. ParseError NetRc
164164parseNetRc = P. parse (netRcParsec <* P. eof)
165165
166-
167166-- | Reads and parses default @$HOME/.netrc@
168167--
169168-- Returns 'Nothing' if @$HOME@ variable undefined and/or if @.netrc@ if missing.
@@ -184,10 +183,6 @@ readUserNetRc = do
184183 Left e | isDoesNotExistError e -> return Nothing
185184 | otherwise -> ioError e
186185 Right b -> return $! Just $! parseNetRc fn b
187- #if !(MIN_VERSION_base(4,6,0))
188- where
189- lookupEnv k = lookup k <$> getEnvironment
190- #endif
191186
192187-- | "Text.Parsec.ByteString" 'P.Parser' for @.netrc@ grammar
193188netRcParsec :: P. Parser NetRc
0 commit comments