summaryrefslogtreecommitdiff
path: root/distrib/compare/Problem.hs
blob: 399e4f804e3e7148639c9ef9382f046b250cb2fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

module Problem where

data FileProblem = First  Problem
                 | Second Problem
                 | Change Problem

data Problem = DuplicateFile FilePath
             | ExtraFile FilePath
             | ExtraWay String
             | PermissionsChanged FilePath FilePath String String
             | FileSizeChanged FilePath FilePath Integer Integer

pprFileProblem :: FileProblem -> String
pprFileProblem (First  p) = "First  " ++ pprProblem p
pprFileProblem (Second p) = "Second " ++ pprProblem p
pprFileProblem (Change p) = "Change " ++ pprProblem p

pprProblem :: Problem -> String
pprProblem (DuplicateFile fp) = "Duplicate file: " ++ show fp
pprProblem (ExtraFile fp) = "Extra file: " ++ show fp
pprProblem (ExtraWay w) = "Extra way: " ++ show w
pprProblem (PermissionsChanged fp1 fp2 p1 p2)
    = "Permissions changed:\n"
   ++ "    " ++ show fp1
   ++ "    " ++ show fp2
   ++ "    " ++ p1 ++ "  ->  " ++ p2
pprProblem (FileSizeChanged fp1 fp2 s1 s2)
    = "Size changed:\n"
   ++ "    " ++ show fp1 ++ "\n"
   ++ "    " ++ show fp2 ++ "\n"
   ++ "    " ++ show s1 ++ "  ->  " ++ show s2