I'm writing a Haskell compiler in C as a hobby. I didn't take a look at GHC code but now I find the way they deal with optional indentation interesting. Nonetheless I implemented the same thing in a simpler way having a function in my parser that checks for the presence or absence of curly braces and sets some state on the parser.
My implementation: https://github.com/angel-manuel/schc/blob/c1fa77b332a765b476...