Commit 7843c71c authored by Simon Marlow's avatar Simon Marlow

Make T8761 deterministic, I hope

Summary:
T8761 seems to get different interleaving in its output on
Phabricator, so this switches it to use stderr consistently.

Test Plan: worksforme

Reviewers: goldfire, austin, bgamari, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2363
parent da60e3e9
......@@ -34,7 +34,7 @@ do
pats <- sequence [prefixPat, infixPat, recordPat]
-- pretty print the pattern synonyms:
mapM_ (runIO . putStrLn . pprint) pats
mapM_ (runIO . hPutStrLn stderr . pprint) pats
-- splice in the pattern synonyms
return pats
......@@ -108,10 +108,10 @@ getY1' = y1 ((1, 2), [3]) -- should yield 3
do
infos <- mapM reify [ 'P, 'Pe, 'Pu, 'Pue, 'Pur, 'Purp
, 'Pure, 'Purep, 'Pep, 'Pup, 'Puep ]
mapM_ (runIO . putStrLn . pprint) infos
runIO $ hFlush stdout
-- GHC does not guarantee to do this after TH code. In particular
-- when the output is going to a file, and we're using GHC with
-- the runtime linker or with -fexternal-interpreter, stdout will
-- not get flushed.
mapM_ (runIO . hPutStrLn stderr . pprint) infos
-- NB. use stderr rather than stdout, because GHC does not
-- guarantee to flush stdout after TH code. In particular when
-- the output is going to a file, and we're using GHC with the
-- runtime linker or with -fexternal-interpreter, stdout will not
-- get flushed.
[d| theAnswerIs = 42 |]
pattern Q1 x1_0 x2_1 x3_2 <- ((x1_0, x2_1), [x3_2], _, _)
pattern x1_0 Q2 x2_1 = ((x1_0, x2_1))
pattern Q3 {qx3, qy3, qz3} <- ((qx3, qy3), [qz3]) where
Q3 qx3 qy3 qz3 = ((qx3, qy3), [qz3])
T8761.hs:(16,1)-(39,13): Splicing declarations
do { [qx1, qy1, qz1] <- mapM
(\ i -> newName $ "x" ++ show i) [1, 2, 3];
......@@ -25,7 +29,7 @@ T8761.hs:(16,1)-(39,13): Splicing declarations
= patSynD
nm3 (recordPatSyn [qx3, qy3, qz3]) (explBidir [cls]) patP;
pats <- sequence [prefixPat, infixPat, recordPat];
mapM_ (runIO . putStrLn . pprint) pats;
mapM_ (runIO . hPutStrLn stderr . pprint) pats;
return pats }
======>
pattern Q1 x1 x2 x3 <- ((x1, x2), [x3], _, _)
......@@ -119,10 +123,6 @@ T8761.hs:(71,1)-(105,39): Splicing declarations
pattern Pup x <- MkUnivProv x
pattern Puep :: forall a. forall b. Show b => a -> b -> (ExProv, a)
pattern Puep x y <- (MkExProv y, x)
pattern Q1 x1_0 x2_1 x3_2 <- ((x1_0, x2_1), [x3_2], _, _)
pattern x1_0 Q2 x2_1 = ((x1_0, x2_1))
pattern Q3 {qx3, qy3, qz3} <- ((qx3, qy3), [qz3]) where
Q3 qx3 qy3 qz3 = ((qx3, qy3), [qz3])
pattern T8761.P :: GHC.Types.Bool
pattern T8761.Pe :: () => forall (a0_0 :: *) . a0_0 -> T8761.Ex
pattern T8761.Pu :: forall (a0_0 :: *) . a0_0 -> a0_0
......@@ -152,8 +152,7 @@ T8761.hs:(108,1)-(117,25): Splicing declarations
reify
['P, 'Pe, 'Pu, 'Pue, 'Pur, 'Purp, 'Pure, 'Purep, 'Pep, 'Pup,
'Puep];
mapM_ (runIO . putStrLn . pprint) infos;
runIO $ hFlush stdout;
mapM_ (runIO . hPutStrLn stderr . pprint) infos;
[d| theAnswerIs = 42 |] }
======>
theAnswerIs = 42
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment