Hi all,
First of all thanks for those organizing this discourse Haskell, as a total beginner on Haskell, it is being useful to have an idea of Haskell community. I don’t know if this is the best place to write a beginner questions, so my apologies if this is more for advanced users.
I am trying to learn it with examples after a basic read of the syntax of the language, but it is being difficult. For example to define a function that creates several directories and returns to the previous path. I was able to make it work like this:
import System.Directory (createDirectory, setCurrentDirectory, getCurrentDirectory)
import Data.List.Split (splitOn)
main :: IO ()
main = do
let currentPath = getCurrentDirectory
let path = splitOn "/" "dirA/subdirB/subsubdirC"
mapM_ (\x -> createDirectory x >> setCurrentDirectory x) path
setCurrentDirectory =<< currentPath
however, when I try to translate this piece of code to a function (before the main) I have a lot of problems. So I guess that probably I don’t understand some key concepts related with let-where-do. Any advice or resource to read would be very appreciated. Thanks!