Q:

Changing variable values from a list in Haskell

I have to make a todo app.  Create and delete functions are done but I need to create an edit function, the same with the delete function, taking a variable by number and edit it.  I'm a newbie in this field.  Thank you.  
putTodo :: (Int, String) -> IO ()
putTodo (n, todo) = putStrLn (show n ++ ": " ++ todo)

prompt :: [String] -> IO ()
prompt todos = do
    putStrLn "The list has:"
    mapM_ putTodo (zip [0..] todos)
    putStrLn " "
    command <- getLine
    getCommand command todos

getCommand :: String -> [String] -> IO ()
getCommand ('+':' ':todo) todos = prompt (todo:todos)
getCommand ('-':' ':num) todos = 
    case delete (read num) todos of
        Nothing -> do
            putStrLn "That number isn't correct." 
            prompt todos
        Just todos' -> prompt todos'
getCommand "exit"      todos = return ()
getCommand command  todos = do
    putStrLn ("Invalid: '" ++ command ++ "'")
    prompt todos

delete :: Int -> [a] -> Maybe [a]
delete 0 (_:as) = Just as
delete n (a:as) = do
    let x = n - 1
    y <- x `seq` delete x as
    return (a:y)
delete _ [] = Nothing

main = do

A:

All what your edit function needs to do is take another argument that will change the edited item:
edit :: Int -> (a -> a) -> [a] -> Maybe [a]
edit 0 f (a:as) = Just (f a : as)
edit n (a:as) = do
    let x = n - 1
    y <- x `seq` edit x f as
    return (a:y)
edit _ [] = Nothing

