Incorrect program produced, different result with equivalent code
edit :
Actually, I realized that this is not a bug. This is due to the lack of type signatures in my program. I thought that was a bug because sometimes the program used Int
s, sometimes Integer
s, and just expanding a definition can change this (see the code in attachment). I apologize for opening a ticket for that (I thought Integer
s were used since it is the case in ghci).
Below my original message.
The program enters an infinite loop (100% cpu, not stopping) because it fails to recognize the stopping condition of a takeWhile
. If we make the list finite, it takes all the elements while it should stop before.
I don't know how to simplify the code since if I change it a little (e.g. by replacing the name of an object by its definition), sometimes it works well, sometimes not.
When I enter the code in ghci, it works well but not when compiled.
I don't know if I should explain what the code was for initially, tell me.