make LTS branch pre-releases
[cabal.git] / cabal-install-solver / src / Distribution / Solver / Modular / Log.hs
blob321a051070b26d57b249c0b81884daa4642b5c09
1 module Distribution.Solver.Modular.Log
2 ( displayLogMessages
3 , SolverFailure(..)
4 ) where
6 import Prelude ()
7 import Distribution.Solver.Compat.Prelude
9 import Distribution.Solver.Types.Progress
11 import Distribution.Solver.Modular.Dependency
12 import Distribution.Solver.Modular.Message
13 import Distribution.Solver.Modular.RetryLog
15 -- | Information about a dependency solver failure.
16 data SolverFailure =
17 ExhaustiveSearch ConflictSet ConflictMap
18 | BackjumpLimitReached
20 -- | Postprocesses a log file. This function discards all log messages and
21 -- avoids calling 'showMessages' if the log isn't needed (specified by
22 -- 'keepLog'), for efficiency.
23 displayLogMessages :: Bool
24 -> RetryLog Message SolverFailure a
25 -> RetryLog String SolverFailure a
26 displayLogMessages keepLog lg = fromProgress $
27 if keepLog
28 then showMessages progress
29 else foldProgress (const id) Fail Done progress
30 where
31 progress = toProgress lg