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
-- parseExpr :: something -> Either ParseError Expression | |
convert :: String -> Either String String | |
convert input = case parseExpr input of | |
Left err -> Left $ show err | |
Right x -> Right $ show x | |
-- Want: | |
convert = magicfunction show $ parseExpr |
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
data Tree a = Leaf a | Node a [Tree a] | |
scanDir :: String -> IO (Tree String) | |
scanDir path = do | |
contents <- getDirectoryContents path `catch` const (return []) | |
let files = sort . filter (`notElem` [".", ".."]) $ contents | |
let pathsAndFiles = zip (repeat path) files | |
tree <- forM pathsAndFiles $ \(path, file) -> do | |
isDirectory <- doesDirectoryExist path | |
if isDirectory |
NewerOlder