Commenting Haskell Code in TextWrangler Using Blocks

Comments are included in the white space in a certain format. Therefore, when parsing, the parser will ignore any comments or normal white space such as blanks, tabs or newlines. Typically, to skip all white space after a lexeme, one would use a white-space skipper. This will allow the top-level parser to skip any initial white space in the source. Afterward, all white space, including comments, will be handled automatically by the parser generated.


Based on my assumption, you are utilizing TextWrangler on the OS X platform.

While using TextWrangler, look for the AppleScript button, which appears as a scroll in the menu bar. Upon clicking it, select the ‘Open Script Editor’ option. After that, navigate to your Desktop folder and create a new document. Give the file a name such as ‘comment_script’, and then proceed to type the desired text into the editor window.

tell application "TextWrangler"
    set my_selection to selection
    set my_selection to "{-n" & my_selection & "n-}"
    set selection to my_selection
end tell

After finishing, save and exit the editor. Then, transfer the comment_script file to the

~/Library/Application Support/TextWrangler/Scripts


In the script menu (the one with the scroll), you can now access


. To comment a selection in TextWrangler, simply select the text and click on


in the script menu.

Frequently Asked Questions

Posted in Uncategorized