f80c8567ee6ee2eeea00311e3e36631399c9b9a0
[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              | PermissionsChanged FilePath FilePath String String
11              | FileSizeChanged FilePath FilePath Integer Integer
12
13 pprFileProblem :: FileProblem -> String
14 pprFileProblem (First  p) = "First  " ++ pprProblem p
15 pprFileProblem (Second p) = "Second " ++ pprProblem p
16 pprFileProblem (Change p) = "Change " ++ pprProblem p
17
18 pprProblem :: Problem -> String
19 pprProblem (DuplicateFile fp) = "Duplicate file: " ++ show fp
20 pprProblem (ExtraFile fp) = "Extra file: " ++ show fp
21 pprProblem (PermissionsChanged fp1 fp2 p1 p2)
22     = "Permissions changed:\n"
23    ++ "    " ++ show fp1
24    ++ "    " ++ show fp2
25    ++ "    " ++ p1 ++ "  ->  " ++ p2
26 pprProblem (FileSizeChanged fp1 fp2 s1 s2)
27     = "Size changed:\n"
28    ++ "    " ++ show fp1 ++ "\n"
29    ++ "    " ++ show fp2 ++ "\n"
30    ++ "    " ++ show s1 ++ "  ->  " ++ show s2
31