The below code gives back a list of String but I want it work on multiple cases. The problem is that I can't create the same exact result with recursion. The program gives back the following result:
replaceTabs 6 ["\thello world"]
=> [" hello world"]
Now this should work with a longer list like:
replaceTabs 6 ["asd dsa","\thello world"]
=> ["asd dsa"," hello world"]
Simple concat doesn't work, because it will give back undefined pattern.
replaceTab' :: Int -> [[Char]] -> [Char]
replaceTab' n [[x]] =
if x == '\t' then replicate n ' '
else [x]
replaceTabs :: Int -> [String]-> [String]
replaceTabs n [""] = [""]
replaceTabs n (x:xs) = (return . concat $ [replaceTab' n [a] | a <- (map (:[]) (x))])