Hack to get the compare tool to work on Windows "bindists"
[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 isSizeChange :: FileProblem -> Bool
15 isSizeChange (Change (FileSizeChanged {})) = True
16 isSizeChange _ = False
17
18 pprFileProblem :: FileProblem -> String
19 pprFileProblem (First  p) = "First  " ++ pprProblem p
20 pprFileProblem (Second p) = "Second " ++ pprProblem p
21 pprFileProblem (Change p) = "Change " ++ pprProblem p
22
23 pprProblem :: Problem -> String
24 pprProblem (DuplicateFile fp) = "Duplicate file: " ++ show fp
25 pprProblem (ExtraFile fp) = "Extra file: " ++ show fp
26 pprProblem (ExtraWay w) = "Extra way: " ++ show w
27 pprProblem (PermissionsChanged fp1 fp2 p1 p2)
28     = "Permissions changed:\n"
29    ++ "    " ++ show fp1
30    ++ "    " ++ show fp2
31    ++ "    " ++ p1 ++ "  ->  " ++ p2
32 pprProblem (FileSizeChanged fp1 fp2 s1 s2)
33     = "Size changed:\n"
34    ++ "    " ++ show fp1 ++ "\n"
35    ++ "    " ++ show fp2 ++ "\n"
36    ++ "    " ++ show s1 ++ "  ->  " ++ show s2
37