
29 Jun
2017
29 Jun
'17
8:33 a.m.
I want to replace lines with the content of a file if the line is a filename
{-# LANGUAGE LambdaCase #-} test = do putStrLn $ concatMap (\l -> l ++ "\n") $ map (\case l | (isPrefixOf "./" l) -> readFile l | otherwise -> l)
But since l is a String and readFile gives an IO String this doesn't work. How should I get around this? Kind regards, Jona