*((     portable experimental-Brandon Simmons <brandon.m.simmons@gmail.com>an element in a FilePath: Ea simple wrapper to hold a base directory name, which can be either H an absolute or relative path. This lets us give the DirTree a context, M while still letting us store only directory and file NAMES (not full paths) 0 in the DirTree. (uses an infix constructor; don' t be scared) Gthe String in the name field is always a file name, never a full path. N The free type variable is used in the File constructor and can hold Handles,  Strings representing a file'.s contents or anything else you can think of. H We catch any IO errors in the Failed constructor. an Exception can be  converted to a String with .  Kbuild an AnchoredDirTree, given the path to a directory, opening the files  using readFile.  Uses  1 internally and has the effect of traversing the O entire directory structure, so is not suitable for running on large directory * trees (suggestions or patches welcomed): :same as readDirectory but allows us to, for example, use 6 ByteString.readFile to return a tree of ByteStrings. Fwrite a DirTree of strings to disk. clobbers files of the same name.  doesn'?t affect files in the directories (if any already exist) with  different names: Lwrites the directory structure to disc, then uses the provided function to ' write the contents of Files to disc. 4a simple application of readDirectoryWith openFile: Jbuilds a DirTree from the contents of the directory passed to it, saving O the base directory in the Anchored* wrapper. Errors are caught in the tree in  the Failed constructor. The + fields initially are populated with full * paths to the files they are abstracting. ,True if any Failed constructors in the tree 5True if there are no Failed constructors in the tree returns true if argument is a  constructor: returns a list of  constructors only: <maps a function to convert Failed DirTrees to Files or Dirs $strips away base directory wrapper: Ktuple up the complete filename with the File contents, by building up the O path, trie-style, from the root. The filepath will be relative to the current  directory. ' This allows us to, for example, mapM_ 'uncurry writeFile' over a DirTree of  strings. Iwrites the directory structure (not files) of a DirTree to the anchored 2 directory. can be preparation for writing files:               !"#directory-tree-0.2.1System.Directory.TreeFileNameAnchoredDirTree:/DirTreeFailederrFilefileDirnamecontents readDirectoryreadDirectoryWithwriteDirectorywriteDirectoryWith openDirectorybuild anyFailed successfulfailedfailures failedMapfreezipPaths writeJustDirsbaseGHC.Showshowbuild'topDirbaseDir getDirsFilesremoveNonexistent