Parse error but no mismatched brackets or incorrect indentation


Hello, I’m getting this error


Where my code is

 padron_Docente ((Per nom dni año rol):xs) = if rol == Docente _ then (nom, dni):padron_Docente xs 

If i add more lines to the document the error goes to the last line, if i comment or delete that line of code the error goes away but if i write it again the error comes back. I’m using notepadqq but also tried saving the file with mousepad and the error still there.
I have been editting the document the whole day and no problems until now.

Thanks in advance


your If Expression is missing the else clause. In Haskell, if is always of the form if <predicate> then <expr> else <expr>.


Oh… well that was dumb from my part. Thank you


@Franpg995 You may be interested to know the reason why every if expression must be accompanied by an else. (Or you may not, but I’ll explain just in case!) In other languages, an if encloses a block, so you can just skip execution of the block if the condition isn’t satisfied. But in Haskell, an if is an expression, which evaluates to a value, so you have to have a value to use when the condition isn’t satisfied. (For example, what would be the value of if False then 1?)