Skip to content

Commit

Permalink
Export transform function
Browse files Browse the repository at this point in the history
  • Loading branch information
jberryman committed May 22, 2014
1 parent 1662a0f commit 53a8fd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 5 additions & 5 deletions System/Directory/Tree.hs
Expand Up @@ -69,6 +69,8 @@ module System.Directory.Tree (
, sortDir
, sortDirShape
, filterDir
-- *** Low-level
, transform
-- ** Navigation
, dropTo
-- ** Operators
Expand Down Expand Up @@ -582,11 +584,9 @@ removeNonexistent = filterDir isOkConstructor
isOkError = not . isDoesNotExistErrorType . ioeGetErrorType . err


---- THIS COULD BE USEFUL TO EXPORT:

-- at Dir constructor, apply transformation function to all of directory's
-- contents, then remove the Nothing's and recurse.
-- ALWAYS PRESERVES TOPMOST CONSTRUCTOR:
-- | At 'Dir' constructor, apply transformation function to all of directory's
-- contents, then remove the Nothing's and recurse. This always preserves the
-- topomst constructor.
transform :: (DirTree a -> DirTree a) -> DirTree a -> DirTree a
transform f t = case f t of
(Dir n cs) -> Dir n $ map (transform f) cs
Expand Down
8 changes: 2 additions & 6 deletions directory-tree.cabal
Expand Up @@ -51,15 +51,11 @@ description: A simple directory-like tree datatype, with useful IO functions
.
Any ideas or suggestions for improvements are most welcome :-)
.
/CHANGES/: from 0.10.1
/CHANGES/: from 0.11
.
- added records for AnchoredDirTree: 'anchor', 'dirTree'
.
- 'free' deprecated in favor of 'dirTree'
.
- added a new function 'dropTo'
.
- implemented lenses compatible with "lens" package
- export 'transform' function
.

category: Data, System
Expand Down

0 comments on commit 53a8fd2

Please sign in to comment.