Skip to content

Commit 4636dc7

Browse files
committed
TOSQUASH annoying GHC version fixup
1 parent aeda17a commit 4636dc7

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

ouroboros-consensus/ouroboros-consensus.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ library unstable-consensus-testlib
379379
Test.CsjModel.NonEmptySeq
380380
Test.CsjModel.Perm
381381
Test.CsjModel.StateTypes
382+
Test.CsjModel.UglyStylishHaskellCppWorkaround
382383
Test.LedgerTables
383384
Test.Ouroboros.Consensus.ChainGenerator.Adversarial
384385
Test.Ouroboros.Consensus.ChainGenerator.BitVector

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ChainSync/Client/Jumping.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{-# LANGUAGE FlexibleContexts #-}
55
{-# LANGUAGE FlexibleInstances #-}
66
{-# LANGUAGE LambdaCase #-}
7+
{-# LANGUAGE NamedFieldPuns #-}
78
{-# LANGUAGE RankNTypes #-}
89
{-# LANGUAGE ScopedTypeVariables #-}
910
{-# LANGUAGE StandaloneDeriving #-}
@@ -303,7 +304,11 @@ mkJumping peerContext = Jumping
303304
atomically (nextInstruction (pure ()) peerContext) >>= \case
304305
Strict.Right instr -> pure instr
305306
Strict.Left () -> do
306-
traceWith (tracer peerContext) BlockedOnJump
307+
-- Need to use NamedFieldPuns somewhere in this module,
308+
-- otherwise stylish-haskell complains. But if I remove the
309+
-- LANGUAGE pragma, then there's a lot of name-shadowing
310+
-- warnings.
311+
traceWith (let Context{tracer} = peerContext in tracer) BlockedOnJump
307312
id
308313
$ fmap (Strict.either absurd id)
309314
$ atomically

ouroboros-consensus/src/unstable-consensus-testlib/Test/CsjModel.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import Control.Applicative ((<|>))
3030
import Control.Arrow (first)
3131
import Control.Monad (guard)
3232
import qualified Control.Monad.State.Strict as State
33-
import Data.Foldable (foldl')
3433
import qualified Data.Map.Strict as Map
3534
import qualified Data.Maybe as L (Maybe (Just, Nothing), isJust, maybe)
3635
import Data.Sequence (Seq)
@@ -48,6 +47,7 @@ import Prelude hiding (Either (Left, Right), Maybe (Just, Nothing),
4847
import Test.CsjModel.NonEmptySeq
4948
import Test.CsjModel.Perm
5049
import Test.CsjModel.StateTypes
50+
import Test.CsjModel.UglyStylishHaskellCppWorkaround (foldl')
5151

5252
{-------------------------------------------------------------------------------
5353
Stimuli to and reactions of the CSJ governor
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{-# LANGUAGE CPP #-}
2+
3+
-- | This module exists because:
4+
--
5+
-- - @foldl'@ was added as an export of 'Prelude' starting with GHC 9.10.1
6+
--
7+
-- - @stylish-haskell@ mangles import lists that involve CPP
8+
module Test.CsjModel.UglyStylishHaskellCppWorkaround (foldl') where
9+
10+
#if __GLASGOW_HASKELL__ < 9101
11+
import Data.Foldable (foldl')
12+
#endif

0 commit comments

Comments
 (0)