From db65bbc528db3f29ee49ce2c485c1a9049b776f2 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Sun, 29 Jul 2018 09:59:59 -0400 Subject: [PATCH] Make comments clearer --- src/Yesod/Auth/OAuth2.hs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Yesod/Auth/OAuth2.hs b/src/Yesod/Auth/OAuth2.hs index 53b4395..d9b99e5 100644 --- a/src/Yesod/Auth/OAuth2.hs +++ b/src/Yesod/Auth/OAuth2.hs @@ -62,21 +62,17 @@ authOAuth2Widget widget name oauth getCreds = where login tm = [whamlet|^{widget}|] --- | Read from the values set via @'setExtra'@ +-- | Read the @'AccessToken'@ from the values set via @'setExtra'@ getAccessToken :: Creds m -> Maybe AccessToken getAccessToken = (AccessToken <$>) . lookup "accessToken" . credsExtra --- | Read from the values set via @'setExtra'@ +-- | Read the original profile response from the values set via @'setExtra'@ getUserResponse :: Creds m -> Maybe ByteString getUserResponse = (fromStrict . encodeUtf8 <$>) . lookup "userResponse" . credsExtra --- | Read from the values set via @'setExtra'@, decode as JSON --- --- This is unsafe if the key is missing, but safe with respect to parsing --- errors. --- +-- | @'getUserResponse'@, and decode as JSON getUserResponseJSON :: FromJSON a => Creds m -> Either String a getUserResponseJSON = eitherDecode <=< note "userResponse key not present" . getUserResponse