Skip to content

Commit 44b4af2

Browse files
committed
Mostly explicit imports from external packages
(Thanks to HLS for the suggestions.) This should harden the code base against ecosystem changes like what happened for random-1.3. QuickCheck and HUnit are not imported qualified everywhere yet, because HLS failed on some modules.
1 parent 80fd3e6 commit 44b4af2

File tree

27 files changed

+79
-63
lines changed

27 files changed

+79
-63
lines changed

core/src/Test/Framework.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ import Test.Framework.Core (Test, TestName, testGroup, plusTestOptions, buildTes
1414
import Test.Framework.Options
1515
import Test.Framework.Runners.Console
1616
import Test.Framework.Runners.Options
17-
import Test.Framework.Seed
17+
import Test.Framework.Seed

core/src/Test/Framework/Core.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import Test.Framework.Improving
55
import Test.Framework.Options
66

77
import Control.Arrow (first, second)
8-
import Control.Concurrent.MVar
9-
import Data.Typeable
8+
import Control.Concurrent.MVar ( withMVar, newMVar, MVar )
9+
import Data.Typeable ( Typeable )
1010

1111

1212
-- | Something like the result of a test: works in concert with 'Testlike'.

core/src/Test/Framework/Improving.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module Test.Framework.Improving (
55
) where
66

77
import Control.Concurrent
8-
import Control.Monad
9-
import Control.Applicative as App
8+
( yield, getChanContents, newChan, writeChan, Chan )
9+
import Control.Monad (ap, liftM)
1010

11-
import System.Timeout
11+
import System.Timeout ( timeout )
1212

1313

1414
data i :~> f = Finished f
@@ -41,7 +41,7 @@ instance Applicative (ImprovingIO i f) where
4141
(<*>) = ap
4242

4343
instance Monad (ImprovingIO i f) where
44-
return = App.pure
44+
return = pure
4545
ma >>= f = IIO $ \chan -> do
4646
a <- unIIO ma chan
4747
unIIO (f a) chan

core/src/Test/Framework/Options.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module Test.Framework.Options where
33
import Test.Framework.Seed
44
import Test.Framework.Utilities
55

6-
import Data.Monoid
7-
import Data.Semigroup as Sem hiding (Last(..))
6+
import Data.Monoid ( Last(Last, getLast) )
7+
import Data.Semigroup as Sem ( Semigroup((<>)) )
88

99

1010
type TestOptions = TestOptions' Maybe
@@ -43,5 +43,5 @@ instance Monoid (TestOptions' Maybe) where
4343
topt_maximum_test_depth = Nothing,
4444
topt_timeout = Nothing
4545
}
46-
46+
4747
mappend = (Sem.<>)

core/src/Test/Framework/Providers/API.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ import Test.Framework.Core
1818
import Test.Framework.Improving
1919
import Test.Framework.Options
2020
import Test.Framework.Seed
21-
import Test.Framework.Utilities
21+
import Test.Framework.Utilities

core/src/Test/Framework/Runners/Console.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ import Test.Framework.Utilities
1717

1818
import Control.Monad (when)
1919
import System.Console.GetOpt
20-
import System.Environment
20+
( getOpt,
21+
usageInfo,
22+
ArgDescr(NoArg, ReqArg),
23+
ArgOrder(Permute),
24+
OptDescr(..) )
25+
import System.Environment ( getArgs, getProgName )
2126
import System.Exit
22-
import System.IO
27+
( exitSuccess, exitWith, ExitCode(ExitFailure, ExitSuccess) )
28+
import System.IO ( hIsTerminalDevice, hPutStrLn, stderr, stdout )
2329

2430
-- | @Nothing@ signifies that usage information should be displayed.
2531
-- @Just@ simply gives us the contribution to overall options by the command line option.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Test.Framework.Runners.Console.Colors where
22

3-
import Text.PrettyPrint.ANSI.Leijen
3+
import Text.PrettyPrint.ANSI.Leijen ( green, red, Doc )
44

55

66
colorFail, colorPass :: Doc -> Doc
@@ -9,4 +9,4 @@ colorPass = green
99

1010
colorPassOrFail :: Bool -> Doc -> Doc
1111
colorPassOrFail True = colorPass
12-
colorPassOrFail False = colorFail
12+
colorPassOrFail False = colorFail

core/src/Test/Framework/Runners/Console/ProgressBar.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Test.Framework.Runners.Console.ProgressBar (
22
Progress(..), progressBar
33
) where
44

5-
import Text.PrettyPrint.ANSI.Leijen hiding (width)
5+
import Text.PrettyPrint.ANSI.Leijen ( (<>), char, text, Doc )
66

77

88
data Progress = Progress Int Int
@@ -16,4 +16,4 @@ progressBar color width (Progress count total) = char '[' <> progress_doc <> spa
1616
progress_chars = round (characters_per_tick * fromIntegral count)
1717
space_chars = available_width - progress_chars
1818
progress_doc = color (text (reverse (take progress_chars ('>' : repeat '='))))
19-
space_doc = text (replicate space_chars ' ')
19+
space_doc = text (replicate space_chars ' ')

core/src/Test/Framework/Runners/Console/Run.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ import Test.Framework.Runners.Statistics
1313
import Test.Framework.Runners.TimedConsumption
1414
import Test.Framework.Utilities
1515

16-
import System.Console.ANSI
17-
import System.IO
16+
import System.Console.ANSI ( clearLine, cursorUpLine )
17+
import System.IO ( hFlush, stdout )
1818

1919
import Text.PrettyPrint.ANSI.Leijen
20+
( (<>), (<+>),
21+
brackets, char, empty, indent, linebreak, plain, putDoc, text,
22+
Doc )
2023

2124
import Control.Arrow (second, (&&&))
2225
import Control.Monad (unless)

core/src/Test/Framework/Runners/Console/Statistics.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import Test.Framework.Runners.Statistics
66
import Test.Framework.Runners.Console.Colors
77
import Test.Framework.Runners.Console.Table
88

9-
import Text.PrettyPrint.ANSI.Leijen
9+
import Text.PrettyPrint.ANSI.Leijen ( empty, text, Doc )
1010

11-
import Data.List
11+
import Data.List ( sort )
1212

1313

1414
-- | Displays statistics as a string something like this:
@@ -23,14 +23,14 @@ showFinalTestStatistics :: TestStatistics -> Doc
2323
showFinalTestStatistics ts = renderTable $ [Column label_column] ++ (map Column test_type_columns) ++ [Column total_column]
2424
where
2525
test_types = sort $ testCountTestTypes (ts_total_tests ts)
26-
26+
2727
label_column = [TextCell empty, TextCell (text "Passed"), TextCell (text "Failed"), TextCell (text "Total")]
2828
total_column = [TextCell (text "Total"), testStatusTotal colorPass ts_passed_tests, testStatusTotal colorFail ts_failed_tests, testStatusTotal (colorPassOrFail (ts_no_failures ts)) ts_total_tests]
2929
test_type_columns = [ [TextCell (text test_type), testStat colorPass (countTests ts_passed_tests), testStat colorFail failures, testStat (colorPassOrFail (failures <= 0)) (countTests ts_total_tests)]
3030
| test_type <- test_types
3131
, let countTests = testCountForType test_type . ($ ts)
3232
failures = countTests ts_failed_tests ]
33-
33+
3434
testStatusTotal color status_accessor = TextCell (coloredNumber color (testCountTotal (status_accessor ts)))
3535
testStat color number = TextCell (coloredNumber color number)
3636

@@ -39,4 +39,4 @@ coloredNumber color number
3939
| number == 0 = number_doc
4040
| otherwise = color number_doc
4141
where
42-
number_doc = text (show number)
42+
number_doc = text (show number)

0 commit comments

Comments
 (0)