Bindist comparison tool: Handle differences in the library ways nicely
[ghc-hetmet.git] / distrib / compare / Problem.hs
1
2 module Problem where
3
4 data FileProblem = First  Problem
5                  | Second Problem
6                  | Change Problem
7
8 data Problem = DuplicateFile FilePath
9              | ExtraFile FilePath
10              | ExtraWay String
11              | PermissionsChanged FilePath FilePath String String
12              | FileSizeChanged FilePath FilePath Integer Integer
13
14 pprFileProblem :: FileProblem -> String
15 pprFileProblem (First  p) = "First  " ++ pprProblem p
16 pprFileProblem (Second p) = "Second " ++ pprProblem p
17 pprFileProblem (Change p) = "Change " ++ pprProblem p
18
19 pprProblem :: Problem -> String
20 pprProblem (DuplicateFile fp) = "Duplicate file: " ++ show fp
21 pprProblem (ExtraFile fp) = "Extra file: " ++ show fp
22 pprProblem (ExtraWay w) = "Extra way: " ++ show w
23 pprProblem (PermissionsChanged fp1 fp2 p1 p2)
24     = "Permissions changed:\n"
25    ++ "    " ++ show fp1
26    ++ "    " ++ show fp2
27    ++ "    " ++ p1 ++ "  ->  " ++ p2
28 pprProblem (FileSizeChanged fp1 fp2 s1 s2)
29     = "Size changed:\n"
30    ++ "    " ++ show fp1 ++ "\n"
31    ++ "    " ++ show fp2 ++ "\n"
32    ++ "    " ++ show s1 ++ "  ->  " ++ show s2
33