I had a surprising and amusing experience using Ormolu that I thought would be interesting for others to see. I was really puzzled why this code behaved incorrectly. One of the strange behaviours was that sometimes H
wasn’t being printed.
"\ESC["
++ show (if wasWrapnext then oldym1 + 1 else oldym1)
++ ";"
++ if wasWrapnext then "1" else show (oldxm1 + 1)
++ "H"
After 30 minutes of trying to debug it I absent mindedly formatted with Ormolu, revealing the error. The H
is part of the else
branch!
"\ESC["
++ show (if wasWrapnext then oldym1 + 1 else oldym1)
++ ";"
++ if wasWrapnext
then "1"
else
show (oldxm1 + 1)
++ "H"