[GHC] #3719: Literate code with #

GHC ghc-devs at haskell.org
Wed May 21 14:07:31 UTC 2014


#3719: Literate code with #
----------------------------------------------+----------------------------
        Reporter:  zenzike                    |            Owner:
            Type:  bug                        |           Status:  closed
        Priority:  normal                     |        Milestone:
       Component:  Compiler (Parser)          |          Version:  6.10.4
      Resolution:  wontfix                    |         Keywords:
Operating System:  Unknown/Multiple           |     Architecture:
 Type of failure:  GHC rejects valid program  |  Unknown/Multiple
       Test Case:                             |       Difficulty:  Unknown
        Blocking:                             |       Blocked By:
                                              |  Related Tickets:
----------------------------------------------+----------------------------
Changes (by heisenbug):

 * difficulty:   => Unknown


Comment:

 `unlit` already has shebang filtering:
 https://github.com/ghc/ghc/blob/master/utils/unlit/unlit.c#L184

 Why not give a `-filter-cpp` option to it, so that all lines with
 whitespace followed by '#' are filtered out?

 Then GHC (when invoked with -XNoCPP) would just pass on `-filter-cpp` to
 `unlit`.

 My use-case is an `emacs` org-mode document with embedded literate Haskell
 like this:
 {{{
 #+begin_src literate-haskell

 > expr2final :: (Arith' repr, Cond repr) => Expr a -> repr a
 > expr2final (Lit i) = lit' i
 > expr2final (e `Plus` e') = expr2final e `plus'` expr2final e'
 > expr2final (e `Cmp` e') = expr2final e `cmp` expr2final e'
 > expr2final (If c e e') = if' (expr2final c) (expr2final e) (expr2final
 e')

 #+end_src
 }}}
 This results in the same error
 {{{
 lexical error at character '+'
 }}}
 and is pretty annoying. Org-mode expects the '#' int the first column, so
 indenting does not help here.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/3719#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list