Skip to content

Commit

Permalink
Fix code formatting to comply with fourmolu
Browse files Browse the repository at this point in the history
  • Loading branch information
SebTee committed Jul 15, 2023
1 parent f0fe9df commit 09eb4b0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions cabal-install/src/Distribution/Client/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ import Distribution.Client.Types
, isRelaxDeps
, unRepoName
)
import Distribution.Client.Types.Credentials
( Token (..)
, Password (..)
import Distribution.Client.Types.Credentials
( Password (..)
, Token (..)
, Username (..)
)
import Distribution.Utils.NubList
Expand Down
15 changes: 8 additions & 7 deletions cabal-install/src/Distribution/Client/HttpUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,11 @@ curlTransport prog =
]
, progInvokeArgs = ["--config", "-"] ++ progInvokeArgs progInvocation
}
Just (Right token) ->
Just (Right token) ->
progInvocation
{ progInvokeArgs = ["--header", "Authorization: X-ApiKey " ++ token]
++ progInvokeArgs progInvocation
{ progInvokeArgs =
["--header", "Authorization: X-ApiKey " ++ token]
++ progInvokeArgs progInvocation
}
Nothing -> progInvocation

Expand Down Expand Up @@ -928,10 +929,10 @@ powershellTransport prog =

setupAuth (Just (Left (uname, passwd))) =
[ "$request.Credentials = new-object System.Net.NetworkCredential("
++ escape uname
++ ","
++ escape passwd
++ ",\"\");"
++ escape uname
++ ","
++ escape passwd
++ ",\"\");"
]
setupAuth (Just (Right token)) =
["$request.Headers[\"Authorization\"] = " ++ escape ("X-ApiKey " ++ token)]
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ import Distribution.Client.Compat.Prelude hiding (get)
import Prelude ()

import Distribution.Client.Types.AllowNewer (AllowNewer (..), AllowOlder (..), RelaxDeps (..))
import Distribution.Client.Types.Credentials (Token (..), Password (..), Username (..))
import Distribution.Client.Types.Credentials (Password (..), Token (..), Username (..))
import Distribution.Client.Types.Repo (LocalRepo (..), RemoteRepo (..))
import Distribution.Client.Types.WriteGhcEnvironmentFilesPolicy

Expand Down
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/Types/Credentials.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Distribution.Client.Types.Credentials
, Password (..)
) where

import Prelude (String, Either)
import Prelude (Either, String)

-- | Either (username, password) or authentacation token
type Auth = Either (String, String) String
Expand Down
14 changes: 7 additions & 7 deletions cabal-install/src/Distribution/Client/Upload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import Distribution.Client.Setup
)
import Distribution.Client.Types.Credentials
( Auth
, Token (..)
, Password (..)
, Token (..)
, Username (..)
)
import Distribution.Client.Types.Repo (RemoteRepo (..), Repo, maybeRepoRemote)
Expand Down Expand Up @@ -301,9 +301,9 @@ createAuth
-> Maybe Password
-> IO Auth
createAuth domain mToken mUsername mPassword = case mToken of
Just token -> return $ Right $ unToken token
-- Use username and password if no token is provided
Nothing -> do
Username username <- maybe (promptUsername domain) return mUsername
Password password <- maybe (promptPassword domain) return mPassword
return $ Left (username, password)
Just token -> return $ Right $ unToken token
-- Use username and password if no token is provided
Nothing -> do
Username username <- maybe (promptUsername domain) return mUsername
Password password <- maybe (promptPassword domain) return mPassword
return $ Left (username, password)

0 comments on commit 09eb4b0

Please sign in to comment.