Text-based menu to manipulate a database text file
I'd do Maybe FilePath -&gt; IO ():

menu :: IO ()
menu = do
    (mapM_ putStrLn . map showChoice) choices
    c &lt;- get "Enter the letter corresonding to the action of choice:"
    case filter ((== c) . fst3) choices of
    [] -&gt; back "Not a valid choice. Try again"
    (_, _, f) : _ -&gt; maybeName &gt;&gt;= maybe menu (maybeFile &gt;=&gt; f)

createdb :: Maybe FilePath -&gt; IO ()
createdb (Just file) = back $ "Error: \"" ++ file ++ "\" already exists." 
createdb Nothing = do
  cols &lt;- get "Enter unique column names in the form n1,n2,...,n (No spaces):"
  let spl = splitOnComma $ toLower' cols
  if hasDuplicates spl || any (elem ' ') spl
    then back "Error: Column names must be unique and have no spaces."
    else writeFile (name ++ ".txt") (cols ++ "\n")

deletedb :: Maybe FilePath -&gt; IO ()
deletedb Nothing = back $ "Error: Could not find that database."
deletedb (Just file) = removeFile file