Skip to content

Commit 5491ebf

Browse files
authored
Data.ByteString.Short: import members of class Eq and class Ord explicitly (#718)
* Data.ByteString.Short: import members of class Eq and class Ord explicitly This is in case someone in future actually implements "The Eq of no (/=)" proposal (haskell/core-libraries-committee#3), which will make `Eq(..)` not to import `(/=)`. I'm not aware of any proposals to change the composition of `Ord(..)` at the moment, but it feels more consistent to make it explicit too. * Fix FreeBSD CI * Fix OpenBSD CI * Tests: work around LazyHClose, these tests are not runnable concurrently
1 parent ea0d6a3 commit 5491ebf

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

.cirrus.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
task:
22
name: FreeBSD
33
freebsd_instance:
4-
image_family: freebsd-14-2
4+
image_family: freebsd-14-3
55
install_script:
66
- pkg install -y git gmake
77
- curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
@@ -18,7 +18,8 @@ task:
1818
platform: openbsd
1919
install_script: pkg_add ghc cabal-install git
2020
script:
21-
- export CABAL_DIR=/tmp/.cabal
21+
- mkdir -p /home/cabal
22+
- ln -s /home/cabal $HOME/.cabal
2223
- cabal update
2324
- cabal test --test-show-details=direct
2425

Data/ByteString/Short/Internal.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ import GHC.Stack.Types
229229
( HasCallStack )
230230
import GHC.Word
231231
import Prelude
232-
( Eq(..), Ord(..), Ordering(..), Read(..), Show(..)
232+
( Eq, (==), (/=)
233+
, Ord, compare, (<), (<=), (>), (>=), min, max
234+
, Ordering(..), Read(..), Show(..)
233235
, ($), ($!), error, (++), (.), (||)
234236
, String, userError
235237
, Bool(..), (&&), otherwise

tests/LazyHClose.hs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{-# LANGUAGE CPP #-}
2+
{- HLINT ignore "Use fewer imports" -}
3+
14
module LazyHClose (testSuite) where
25

36
import Control.Monad (void, forM_)
@@ -6,22 +9,31 @@ import Foreign.C.String (withCString)
69
import Foreign.ForeignPtr (finalizeForeignPtr)
710
import System.IO (openFile, openTempFile, hClose, hPutStrLn, IOMode(..))
811
import System.Posix.Internals (c_unlink)
9-
import Test.Tasty (TestTree, testGroup, withResource)
12+
import Test.Tasty (TestTree, withResource)
1013
import Test.Tasty.QuickCheck (testProperty, ioProperty)
1114

1215
import qualified Data.ByteString as S
1316
import qualified Data.ByteString.Char8 as S8
1417
import qualified Data.ByteString.Lazy as L
1518
import qualified Data.ByteString.Lazy.Char8 as L8
1619

20+
#if MIN_VERSION_tasty(1,5,4)
21+
import Test.Tasty (inOrderTestGroup)
22+
#else
23+
import Test.Tasty (testGroup)
24+
25+
inOrderTestGroup :: String -> [TestTree] -> TestTree
26+
inOrderTestGroup = testGroup
27+
#endif
28+
1729
n :: Int
1830
n = 1000
1931

2032
testSuite :: TestTree
2133
testSuite = withResource
2234
(do (fn, h) <- openTempFile "." "lazy-hclose-test.tmp"; hPutStrLn h "x"; hClose h; pure fn)
2335
removeFile $ \fn' ->
24-
testGroup "LazyHClose"
36+
inOrderTestGroup "LazyHClose"
2537
[ testProperty "Testing resource leaks for Strict.readFile" $ ioProperty $
2638
forM_ [1..n] $ const $ do
2739
fn <- fn'

0 commit comments

Comments
 (0)