Skip to content

Instantly share code, notes, and snippets.

@bigos
Created August 26, 2018 23:51
Show Gist options
  • Save bigos/9794fbe50c96f13b1ad45fe6f609763f to your computer and use it in GitHub Desktop.
Save bigos/9794fbe50c96f13b1ad45fe6f609763f to your computer and use it in GitHub Desktop.
problem with nesting if statements in haskell
check_if_proceed configFolders = do
let emacsdf = "/home/jacek/.emacs.d"
traceM ("calling check_if_proceed " ++ show ("ccc",configFolders))
exists <- doesDirectoryExist emacsdf
symlink <- pathIsSymbolicLink emacsdf
let confemp = configFolders == []
let result = False
if exists
then do
{
if symlink
then do
{
putStrLn ("This action will overwrite the existing symlink\n"++
"poinitng to " ++ "SOMEWHERE-FINISH ME\n\n" )
}
else do
{
putStrLn (emacsdf ++ " is not a symlink\n"++
"to use this utility, in your terminal do soemthing like:\n"++
"$ mv " ++ emacsdf ++ " " ++ emacsdf ++ "-alternative-config\n" ++
"exiting..." )
}
}
else do
{
putStrLn ("no " ++ emacsdf ++ "found in your home folder")
if confemp
then do
{
putStrLn ("nor folders with the alternative emacs config\n" ++
"exiting..." )
}
else
do {
putStrLn "will try to symlink one of the found folders"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment