aboutsummaryrefslogtreecommitdiff
path: root/ch09/9_b_1.hs
blob: 75049892c31d2fcfdc1dd92204cece741c1490e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- What you should pass to 'traverse' to traverse a directory tree in reverse
-- alphabetic order?

-- ghci> :l ControlledVisit.hs
-- [1 of 1] Compiling ControlledVisit  ( ControlledVisit.hs, interpreted )
-- Ok, one module loaded.

-- Import Data.List module for getting the 'sort' function
-- ghci> :m +Data.List

-- Output of the following command is manually shortened and formatted for clarity
-- ghci> traverse' (reverse.sort) "test-9_b_1"
-- [Info {infoPath = "test-9_b_1/dirD/H", ...},
--  Info {infoPath = "test-9_b_1/dirD/G", ...},
--  Info {infoPath = "test-9_b_1/dirD", ...},
--  Info {infoPath = "test-9_b_1/dirC/F", ...},
--  Info {infoPath = "test-9_b_1/dirC/E", ...},
--  Info {infoPath = "test-9_b_1/dirC", ...},
--  Info {infoPath = "test-9_b_1/B", ...},
--  Info {infoPath = "test-9_b_1/A", ...},
--  Info {infoPath = "test-9_b_1", ...}]