Created
January 12, 2017 17:00
-
-
Save kgadek/becd454445a64fd9607bd7967a5b4861 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runWithMock :: MockDirectoryTree -> FSops r -> [String] | |
runWithMock mockTree = cata eval | |
where | |
eval :: TF.FreeF FSopsF r [String] -> [String] | |
eval (TF.Free x@ListDir{}) = msg : cont | |
where | |
msg = printf "LISTDIR: %s\n RESULT: %s\n" (x ^. dirName) (show dirListing) | |
dirListing = DirectoryListing immediateDirs immediateFiles | |
immediateDirs = mockTree ^.. unFix2 . mDirs . each . rootDirName | |
immediateFiles = mockTree ^. unFix2 . mFiles | |
cont = (x ^. continueWithDirectoryListing) dirListing | |
eval (TF.Pure _) = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment