I want to write a file that has information about when I can schedule an exam, the date(given a limit of days for all the exams) and which room(given a limited number of rooms) but the exam subject is to be defined according to a file which has all the, number id of the subjects, the year of the subjects and the name of the subjects, all in separate lines, and there can't be more than one exam in the same room.
I would like store those 3 values for each subject in a list of tuple so when I print it out I just get a list of tuples. I'm trying to tackle this in Haskell and so far I got to this point but, I can't seem to understand the errors this code is giving me.
Sorry for the dumb question, kind of new to Haskell, also the variables and function names are not in English.
     atribuituple dias sala (li:lis) tupleList = do
                    if dias > 0 then
                         atribuituplesala dias sala last(words li) tupleList
                         atribuituple (dias-1) sala lis tupleList
                    else
                         return()
                    
      
     atribuituplesala dias sala uc tupleList = do
                    if  sala > 0 then
                         tupleList ++ (dias,sala,uc)
                         atribuituplesala dias (sala-1) uc tupleList
                    else
                         return()
     save_uc_dia dias sala = do
               ucs <- openFile "ucs.txt" ReadMode
               exames_uc_dia_sala_W <- openFile "exames_uc_dia_sala.txt" WriteMode
               let tupla = [] 
               atribuituple dias sala (lines ucs) tupla
               writeFile "exames_uc_dia_sala.txt" tupla
               hClose ucs
               hClose exames_uc_dia_sala_W
I was expecting to receive a list of tuples in a file called "exames_uc_dia_sala.txt" according to all the limitations the initial problem has given me.
 
     
    