switch to Haskell2010

When I put in Haskell98 this spring, I was under the mistaken
apprehension that ghc defaulted to that. But it actually its default
is a third mode, which is closer to Haskell2010 but with some differences.
The manual says "By default, GHC mainly aims to behave (mostly) like a
Haskell 2010 compiler"

Fixed two cases where the Haskell98 do indentation flexability let
wrongly indented code build. That is one of the places where
ghc does not behave like Haskell2010 by default.

The other place that I think I was concerned about, is GHC manual
section 19.1.1.3. Expressions and patterns. But that only seems to
affect code using bottoms, so would only affect pure functions throwing
an error, which I don't think git-annex does in many places as it's
pretty horrid style. And it would only affect rare cases like shown in
that section. If it did happen, it would mean that the error was not
thrown before specifying Haskell98, and then was. Haskell2010 behaves
the same as Haskell98.

This commit was sponsored by Denis Dzyubenko on Patreon.
This commit is contained in:
Joey Hess 2020-10-19 11:14:01 -04:00
parent e4a8b7b26f
commit 2dd38b6403
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 15 additions and 14 deletions

View file

@ -38,12 +38,13 @@ seek :: UpgradeOptions -> CommandSeek
seek o = commandAction (start o) seek o = commandAction (start o)
start :: UpgradeOptions -> CommandStart start :: UpgradeOptions -> CommandStart
start (UpgradeOptions { autoOnly = True }) = do start (UpgradeOptions { autoOnly = True }) =
starting "upgrade" (ActionItemOther Nothing) (SeekInput []) $ do starting "upgrade" (ActionItemOther Nothing) (SeekInput []) $ do
getVersion >>= maybe noop checkUpgrade getVersion >>= maybe noop checkUpgrade
next $ return True next $ return True
start _ = starting "upgrade" (ActionItemOther Nothing) (SeekInput []) $ do start _ =
whenM (isNothing <$> getVersion) $ do starting "upgrade" (ActionItemOther Nothing) (SeekInput []) $ do
initialize Nothing Nothing whenM (isNothing <$> getVersion) $ do
r <- upgrade False latestVersion initialize Nothing Nothing
next $ return r r <- upgrade False latestVersion
next $ return r

View file

@ -295,11 +295,11 @@ discoverLFSEndpoint tro h
let endpoint' = addbasicauth (Git.credentialBasicAuth cred) endpoint let endpoint' = addbasicauth (Git.credentialBasicAuth cred) endpoint
let testreq' = LFS.startTransferRequest endpoint' transfernothing let testreq' = LFS.startTransferRequest endpoint' transfernothing
flip catchNonAsync (const (returnendpoint endpoint')) $ do flip catchNonAsync (const (returnendpoint endpoint')) $ do
resp' <- makeSmallAPIRequest testreq' resp' <- makeSmallAPIRequest testreq'
inRepo $ if needauth (responseStatus resp') inRepo $ if needauth (responseStatus resp')
then Git.rejectUrlCredential cred then Git.rejectUrlCredential cred
else Git.approveUrlCredential cred else Git.approveUrlCredential cred
returnendpoint endpoint' returnendpoint endpoint'
else returnendpoint endpoint else returnendpoint endpoint
where where
transfernothing = LFS.TransferRequest transfernothing = LFS.TransferRequest

View file

@ -377,7 +377,7 @@ Executable git-annex
DAV (>= 1.0) DAV (>= 1.0)
CC-Options: -Wall CC-Options: -Wall
GHC-Options: -Wall -fno-warn-tabs -Wincomplete-uni-patterns GHC-Options: -Wall -fno-warn-tabs -Wincomplete-uni-patterns
Default-Language: Haskell98 Default-Language: Haskell2010
Default-Extensions: PackageImports, LambdaCase Default-Extensions: PackageImports, LambdaCase
Other-Extensions: TemplateHaskell Other-Extensions: TemplateHaskell
-- Some things don't work with the non-threaded RTS. -- Some things don't work with the non-threaded RTS.