@@ -516,6 +516,10 @@ pprintExceptions exceptions stackYaml stackRoot isImplicitGlobal parentMap wante
516
516
<> blankLine
517
517
<> indent 2 (spacedBulletedList recommendations)
518
518
where
519
+ prettyUserConfig = pretty (defaultUserConfigPath stackRoot)
520
+ prettyStackYaml = pretty stackYaml
521
+ isScript = show prettyUserConfig == show prettyStackYaml
522
+
519
523
exceptions' = {- should we dedupe these somehow? nubOrd -} exceptions
520
524
521
525
recommendations =
@@ -539,17 +543,17 @@ pprintExceptions exceptions stackYaml stackRoot isImplicitGlobal parentMap wante
539
543
else
540
544
[ fillSep
541
545
$ [ " in"
542
- , pretty (defaultUserConfigPath stackRoot)
546
+ , prettyUserConfig
543
547
, flow
544
548
( " (global configuration)"
545
549
<> if isImplicitGlobal then " ," else mempty
546
550
)
547
551
]
548
- <> ( if isImplicitGlobal
552
+ <> ( if isImplicitGlobal || isScript
549
553
then []
550
554
else
551
555
[ " or"
552
- , pretty stackYaml
556
+ , prettyStackYaml
553
557
, flow " (project-level configuration),"
554
558
]
555
559
)
@@ -573,18 +577,19 @@ pprintExceptions exceptions stackYaml stackRoot isImplicitGlobal parentMap wante
573
577
, style Current " base" <> " ."
574
578
]
575
579
]
576
- | otherwise =
580
+ | not isScript =
577
581
[ fillSep
578
582
[ style Recommendation (flow " Recommended action:" )
579
583
, flow " try adding the following to your"
580
584
, style Shell " extra-deps"
581
585
, " in"
582
- , pretty stackYaml
586
+ , prettyStackYaml
583
587
, " (project-level configuration):"
584
588
]
585
589
<> blankLine
586
590
<> vsep (map pprintExtra (Map. toList extras))
587
591
]
592
+ | otherwise = []
588
593
589
594
pprintExtra (name, (version, BlobKey cabalHash cabalSize)) =
590
595
let cfInfo = CFIHash cabalHash (Just cabalSize)
@@ -750,7 +755,7 @@ pprintExceptions exceptions stackYaml stackRoot isImplicitGlobal parentMap wante
750
755
latestApplicable mversion =
751
756
case mlatestApplicable of
752
757
Nothing
753
- | isNothing mversion -> fillSep
758
+ | isNothing mversion -> fillSep $
754
759
[ flow " (no matching package and version found. Perhaps there is \
755
760
\an error in the specification of a package's"
756
761
, style Shell " dependencies"
@@ -765,7 +770,9 @@ pprintExceptions exceptions stackYaml stackRoot isImplicitGlobal parentMap wante
765
770
, flow " or an omission from the"
766
771
, style Shell " packages"
767
772
, flow " list in"
768
- , pretty stackYaml
773
+ ]
774
+ ++ if isScript then [] else
775
+ [ prettyStackYaml
769
776
, flow " (project-level configuration).)"
770
777
]
771
778
| otherwise -> " "
0 commit comments