Skip to content

Commit

Permalink
Changes for clean build with ghc-9.4.8
Browse files Browse the repository at this point in the history
- Remove hlint from app-serve
- Wunused-imports
- most but not all -Wambiguous-fields
- MonadFail constraint for COMPLETE patterns
- Wunused-record-wildcards
- Semigroup imports
- -XTemplateHaskell splice ordering
  • Loading branch information
philderbeast committed Feb 10, 2024
1 parent e3ac837 commit 9c9122e
Show file tree
Hide file tree
Showing 53 changed files with 143 additions and 139 deletions.
9 changes: 0 additions & 9 deletions lang-haskell/app-serve/package.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,4 @@ in let deps =
, source-dirs = "src"
}
}
, tests.hlint
=
{ dependencies = [ "base", "hlint", "flight-comp" ]
, ghc-options = [ "-rtsopts", "-threaded", "-with-rtsopts=-N" ]
, main = "HLint.hs"
, source-dirs = "test-suite-hlint"
, when =
{ condition = "flag(suppress-failing-tests)", buildable = False }
}
}
1 change: 1 addition & 0 deletions lang-haskell/clip/test-suite-doctest/DocTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ arguments =
[ "-isrc"
, "library/Flight/Track/Range.hs"
, "-XLambdaCase"
, "-package split"
]

main :: IO ()
Expand Down
1 change: 0 additions & 1 deletion lang-haskell/comp/library/Flight/Comp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ import "flight-gap-math" Flight.Score
)
import "flight-gap-weight" Flight.Score (LwScaling(..), EGwScaling(..))
import Flight.Geodesy (EarthMath(..), EarthModel(..))
import Flight.Path.Types (IxTask(..))

-- | The time of first lead into the speed section. This won't exist if no one
-- is able to cross the start of the speed section without bombing out.
Expand Down
2 changes: 1 addition & 1 deletion lang-haskell/comp/library/Flight/Path/Find.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Flight.Path.Find

import GHC.Records
import System.Directory (doesFileExist, doesDirectoryExist)
import System.FilePath ((</>), FilePath, takeDirectory)
import System.FilePath ((</>), takeDirectory)
import System.FilePath.Find
((==?), (&&?), find, always, fileType, extension, fileName)
import qualified System.FilePath.Find as Find (FileType(..))
Expand Down
2 changes: 1 addition & 1 deletion lang-haskell/comp/library/Flight/Path/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module Flight.Path.Tx

import Data.Coerce (coerce)
import Text.Printf (printf)
import System.FilePath (FilePath, (</>), (<.>), takeDirectory, replaceExtensions)
import System.FilePath ((</>), (<.>), takeDirectory, replaceExtensions)
import "flight-gap-allot" Flight.Score (PilotId(..), PilotName(..), Pilot(..))
import Flight.Path.Types

Expand Down
4 changes: 2 additions & 2 deletions lang-haskell/comp/library/Flight/Track/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,15 @@ dropZeros :: [TickRow] -> [TickRow]
dropZeros =
dropWhile ((== 0) . d)
where
d = togo :: (TickRow -> Double)
d = \TickRow{togo} -> togo

-- | Discard fixes further from goal than any previous fix.
discardFurther :: [TickRow] -> [TickRow]
discardFurther (x : y : ys)
| d x <= d y = discardFurther (x : ys)
| otherwise = x : discardFurther (y : ys)
where
d = togo :: (TickRow -> Double)
d = \TickRow{togo} -> togo
discardFurther ys = ys

commentOnFixRange :: Pilot -> [FixIdx] -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ circum
-- The points of the compass are divided by the number of samples requested.
circumSample :: CircumSample Double
circumSample SampleParams{..} arcSweep@(ArcSweep (Bearing (MkQuantity bearing))) arc0 zoneM zoneN
| bearing < 0 || bearing > 2 * pi = fail "Arc sweep must be in the range 0..2π radians."
| bearing < 0 || bearing > 2 * pi = error "Arc sweep must be in the range 0..2π radians."
| otherwise =
case spSamples of
[] -> fail "Empty list of sample numbers."
[] -> error "Empty list of sample numbers."
sp0 : _ ->
let (θ, xs) = sampleAngles pi sp0 arcSweep arc0 zoneM zoneN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,10 @@ circum
-- The points of the compass are divided by the number of samples requested.
circumSample :: CircumSample Rational
circumSample SampleParams{..} arcSweep@(ArcSweep (Bearing (MkQuantity bearing))) arc0 zoneM zoneN
| bearing < 0 || bearing > 2 * F.pi eps = fail "Arc sweep must be in the range 0..2π radians."
| bearing < 0 || bearing > 2 * F.pi eps = error "Arc sweep must be in the range 0..2π radians."
| otherwise =
case spSamples of
[] -> fail "Empty list of sample numbers."
[] -> error "Empty list of sample numbers."
sp0 : _ ->
let (θ, xs) = sampleAngles (F.pi eps) sp0 arcSweep arc0 zoneM zoneN

Expand Down
4 changes: 2 additions & 2 deletions lang-haskell/earth/library/Internal/Flat/Cylinder/Double.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ translate (Radius (MkQuantity rRadius)) (TrueCourse (MkQuantity rtc)) x =
-- The points of the compass are divided by the number of samples requested.
circumSample :: CircumSample Double
circumSample SampleParams{..} arcSweep@(ArcSweep (Bearing (MkQuantity bearing))) arc0 zoneM zoneN
| bearing < 0 || bearing > 2 * pi = fail "Arc sweep must be in the range 0..2π radians."
| bearing < 0 || bearing > 2 * pi = error "Arc sweep must be in the range 0..2π radians."
| otherwise =
case spSamples of
[] -> fail "Empty list of sample numbers."
[] -> error "Empty list of sample numbers."
sp0 : _ ->
let (θ, xs) = sampleAngles pi sp0 arcSweep arc0 zoneM zoneN

Expand Down
4 changes: 2 additions & 2 deletions lang-haskell/earth/library/Internal/Flat/Cylinder/Rational.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ translate
-- The points of the compass are divided by the number of samples requested.
circumSample :: CircumSample Rational
circumSample SampleParams{..} arcSweep@(ArcSweep (Bearing (MkQuantity bearing))) arc0 zoneM zoneN
| bearing < 0 || bearing > 2 * F.pi eps = fail "Arc sweep must be in the range 0..2π radians."
| bearing < 0 || bearing > 2 * F.pi eps = error "Arc sweep must be in the range 0..2π radians."
| otherwise =
case spSamples of
[] -> fail "Empty list of sample numbers."
[] -> error "Empty list of sample numbers."
sp0 : _ ->
let (θ, xs) = sampleAngles (F.pi eps) sp0 arcSweep arc0 zoneM zoneN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Internal.Flat.PointToPoint.Double
, azimuthRev
) where

import Data.Maybe (maybe)
import Flight.LatLng (AzimuthFwd, AzimuthRev)
import Flight.Zone (Zone(..))
import Flight.Distance (PathDistance(..), SpanLatLng)
Expand Down
4 changes: 2 additions & 2 deletions lang-haskell/earth/library/Internal/Sphere/Cylinder/Double.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ circum x s tc =
-- The points of the compass are divided by the number of samples requested.
circumSample :: CircumSample Double
circumSample SampleParams{..} arcSweep@(ArcSweep (Bearing (MkQuantity bearing))) arc0 zoneM zoneN
| bearing < 0 || bearing > 2 * pi = fail "Arc sweep must be in the range 0..2π radians."
| bearing < 0 || bearing > 2 * pi = error "Arc sweep must be in the range 0..2π radians."
| otherwise =
case spSamples of
[] -> fail "Empty list of sample numbers."
[] -> error "Empty list of sample numbers."
sp0 : _ ->
let (θ, xs) = sampleAngles pi sp0 arcSweep arc0 zoneM zoneN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ circum
-- The points of the compass are divided by the number of samples requested.
circumSample :: CircumSample Rational
circumSample SampleParams{..} arcSweep@(ArcSweep (Bearing (MkQuantity bearing))) arc0 zoneM zoneN
| bearing < 0 || bearing > 2 * F.pi eps = fail "Arc sweep must be in the range 0..2π radians."
| bearing < 0 || bearing > 2 * F.pi eps = error "Arc sweep must be in the range 0..2π radians."
| otherwise =
case spSamples of
[] -> fail "Empty list of sample numbers."
[] -> error "Empty list of sample numbers."
sp0 : _ ->
let (θ, xs) = sampleAngles (F.pi eps) sp0 arcSweep arc0 zoneM zoneN

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Ellipsoid.Ellipsoid (properties) where

import Test.Tasty (TestTree, testGroup)
import Test.Tasty (testGroup)
import Test.Tasty.QuickCheck as QC
import Test.Tasty.Providers as QC

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import qualified Formatting as Fmt ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Data.Maybe (catMaybes)
import Control.Lens ((^?), element)
import Control.Monad (mapM_)
import Control.Monad.Except (runExceptT)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Trans.Except (throwE)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import Data.UnitsOfMeasure (u)
Expand Down
3 changes: 1 addition & 2 deletions lang-haskell/flare-timing/prod-apps/far-out/FarOutMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Data.Maybe (catMaybes)
import Control.Monad (mapM_)
import Control.Monad.Zip (munzip)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)
Expand Down Expand Up @@ -71,7 +70,7 @@ drive o@CmdBatchOptions{file} = do
fprint ("Far outs counted for distance difficulty completed in " % timeSpecs % "\n") start end

go :: CmdBatchOptions -> CompInputFile -> IO ()
go CmdBatchOptions{..} compFile = do
go CmdBatchOptions{} compFile = do
filesTaskAndSettings <-
catchIO
(Just <$> do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import System.Clock (getTime, Clock(Monotonic))
import Data.Maybe (catMaybes, isNothing)
import Data.List (nub, sort)
import Control.Lens ((^?), element)
import Control.Monad (mapM_)
import Control.Monad.Except (runExceptT)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Trans.Except (throwE)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import Data.UnitsOfMeasure (u)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import System.Directory (getCurrentDirectory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import System.Directory (getCurrentDirectory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import Data.UnitsOfMeasure (u)
import Data.UnitsOfMeasure.Internal (Quantity(..))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Data.Ord(Down(Down))
import Data.List (sortOn)
import qualified Data.Map.Strict as Map (fromList, lookup)
import Control.Arrow (second)
import Control.Monad (mapM_)
import Control.Monad.Trans.Except (throwE)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import Data.UnitsOfMeasure (u)
Expand Down
1 change: 0 additions & 1 deletion lang-haskell/flare-timing/prod-apps/fs-trim/FsTrimMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Except (ExceptT(..), runExceptT, lift)
import System.Directory (getCurrentDirectory)

Expand Down
12 changes: 9 additions & 3 deletions lang-haskell/flare-timing/prod-apps/gap-point/GapPointMain.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DuplicateRecordFields #-}

{-# OPTIONS_GHC -fplugin Data.UnitsOfMeasure.Plugin #-}
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}

#if MIN_VERSION_base(4,16,0)
-- TODO: Remove -Wno-ambiguous-fields.
{-# OPTIONS_GHC -Wno-ambiguous-fields #-}
#endif

import Prelude hiding (max)
import qualified Prelude as Stats (max)
import Data.Refined (assumeProp, refined)
Expand All @@ -22,7 +29,6 @@ import qualified Data.Map.Merge.Strict as Map
import Data.List (partition)
import Control.Applicative (liftA2)
import qualified Control.Applicative as A ((<$>))
import Control.Monad (mapM_)
import Control.Monad.Zip (mzip)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)
Expand Down Expand Up @@ -174,7 +180,7 @@ drive o@CmdBatchOptions{file} = do
Fmt.fprint ("Tallying points completed in " Fmt.% timeSpecs Fmt.% "\n") start end

go :: CmdBatchOptions -> CompInputFile -> IO ()
go CmdBatchOptions{..} compFile = do
go CmdBatchOptions{} compFile = do
putStrLn $ "Reading pilots ABS & DNF from task from " ++ show compFile

filesTaskAndSettings <-
Expand Down Expand Up @@ -1424,7 +1430,7 @@ tallyDf

ss' = getTagTime unStart
es' = getTagTime unEnd
getTagTime accessor = (time :: InterpolatedFix -> _) . inter <$> (accessor =<< g)
getTagTime accessor = (\InterpolatedFix{time} -> time) . inter <$> (accessor =<< g)

tallyDfNoTrack
:: Discipline
Expand Down
3 changes: 1 addition & 2 deletions lang-haskell/flare-timing/prod-apps/land-out/LandOutMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Monad.Zip (munzip)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)
Expand Down Expand Up @@ -60,7 +59,7 @@ drive o@CmdBatchOptions{file} = do
fprint ("Land outs counted for distance difficulty completed in " % timeSpecs % "\n") start end

go :: CmdBatchOptions -> CompInputFile -> IO ()
go CmdBatchOptions{..} compFile = do
go CmdBatchOptions{} compFile = do
filesTaskAndSettings <-
catchIO
(Just <$> do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (join, mapM_)
import Control.Monad (join)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)
import Data.Vector (Vector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ drive o@CmdBatchOptions{file} = do
fprint ("Pegging the scoring frame completed in " % timeSpecs % "\n") start end

go :: CmdBatchOptions -> CompInputFile -> IO ()
go CmdBatchOptions{..} compFile = do
go CmdBatchOptions{} compFile = do

filesTaskAndSettings <-
catchIO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import Control.Exception.Safe (catchIO)
import System.Directory (getCurrentDirectory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import System.Console.CmdArgs.Implicit (cmdArgs)
import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Monad (mapM_)
import System.FilePath (takeFileName)
import System.Directory (getCurrentDirectory)
import Control.Exception.Safe (catchIO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Formatting ((%), fprint)
import Formatting.Clock (timeSpecs)
import System.Clock (getTime, Clock(Monotonic))
import Control.Lens ((^?), element)
import Control.Monad (mapM_)
import Control.DeepSeq
import Control.Concurrent.ParallelIO (parallel_)
import Control.Exception.Safe (catchIO)
Expand Down
1 change: 0 additions & 1 deletion lang-haskell/flare-timing/test-apps/igc-parser/IgcMain.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import System.Environment (getProgName)
import System.Console.CmdArgs.Implicit (cmdArgs)
import Control.Monad (mapM_)
import System.FilePath (takeFileName)
import System.Directory (getCurrentDirectory)

Expand Down
1 change: 0 additions & 1 deletion lang-haskell/flare-timing/test-apps/kml-parser/KmlMain.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import System.Environment (getProgName)
import System.Console.CmdArgs.Implicit (cmdArgs)
import Control.Monad (mapM_)
import System.FilePath (takeFileName)
import System.Directory (getCurrentDirectory)

Expand Down
Loading

0 comments on commit 9c9122e

Please sign in to comment.