
Daniel Fischer
That's by design. GHC treats a shebang line as a comment *if the shebang is the very first bytes of the file*. With a BOM, the shebang isn't the start of the file, so it's not treated as a comment.
You might change the ticket to a feature request.
I'll leave it to the Trac administrators to handle as they see fit, but I find it hard to believe this is "by design". Of course, tools like Notepad can be viewed as a little broken because they prepend the BOM, but that's behaviour that can't be completely avoided on Windows. It seems easy enough to check for a BOM and skip that, because the BOM is not strictly part of the file contents; it's just a marker indicating the encoding. The shebang line in the non-working example is the very first thing in the file's actual contents (e.g. as interpreted by Notepad). Of course, for UTF-16/UCS-2 encoded files (also common on Windows), wouldn't the compiler need to check for a BOM anyway? Regards, Vinay Sajip