From 79cd0161d3fbed2c1f07f48d8ed33c7bfdb436a7 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Sat, 27 Jan 2018 11:31:32 -0500 Subject: [PATCH] Rename qualified import --- src/Yesod/Auth/OAuth2/Prelude.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Yesod/Auth/OAuth2/Prelude.hs b/src/Yesod/Auth/OAuth2/Prelude.hs index adc0099..421ed2c 100644 --- a/src/Yesod/Auth/OAuth2/Prelude.hs +++ b/src/Yesod/Auth/OAuth2/Prelude.hs @@ -62,13 +62,14 @@ module Yesod.Auth.OAuth2.Prelude -- * Deprecated, until everything's moved over to @'authGetProfile'@ , authGetJSON , fromProfileURL + , maybeExtra ) where import Control.Exception.Safe import Data.Aeson import Data.ByteString (ByteString) -import qualified Data.ByteString.Lazy as BSL -import qualified Data.ByteString.Lazy.Char8 as BSL8 +import qualified Data.ByteString.Lazy as BL +import qualified Data.ByteString.Lazy.Char8 as BL8 import Data.Semigroup ((<>)) import Data.Text (Text) import qualified Data.Text as T @@ -86,7 +87,7 @@ import Yesod.Auth.OAuth2 -- -- Deprecated. Eventually, we'll return @Either@s all the way up. -- -data YesodOAuth2Exception = InvalidProfileResponse Text BSL.ByteString +data YesodOAuth2Exception = InvalidProfileResponse Text BL.ByteString deriving (Show, Typeable) instance Exception YesodOAuth2Exception @@ -106,22 +107,22 @@ authGetProfile -> Manager -> OAuth2Token -> URI - -> IO (a, BSL.ByteString) + -> IO (a, BL.ByteString) authGetProfile name manager token url = do resp <- fromAuthGet name =<< authGetBS manager (accessToken token) url decoded <- fromAuthJSON name resp pure (decoded, resp) -- | Throws a @Left@ result as an @'InvalidProfileResponse'@ -fromAuthGet :: Text -> Either (OAuth2Error Value) BSL.ByteString -> IO BSL.ByteString +fromAuthGet :: Text -> Either (OAuth2Error Value) BL.ByteString -> IO BL.ByteString fromAuthGet _ (Right bs) = pure bs -- nice fromAuthGet name (Left err) = throwIO $ invalidProfileResponse name err -- | Throws a decoding error as an @'InvalidProfileResponse'@ -fromAuthJSON :: FromJSON a => Text -> BSL.ByteString -> IO a +fromAuthJSON :: FromJSON a => Text -> BL.ByteString -> IO a fromAuthJSON name = -- FIXME: unique exception constructors - either (throwIO . InvalidProfileResponse name . BSL8.pack) pure . eitherDecode + either (throwIO . InvalidProfileResponse name . BL8.pack) pure . eitherDecode -- | Construct an @'InvalidProfileResponse'@ exception from an @'OAuth2Error'@ --