Re: [Haskell-cafe] emacs literate haskell mode
I tried mmm-mode with a few configurations, but I get into trouble when using other haskell-mode features. Also, the wiki page on haskell-mode ( http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs#Literate_Haskell ) specifically mentions mmm-mode tricks are not needed anymore and shouldn't be used. Its built-in support does a great job to keep all code blocks working the way I want, but the latex parts are just dead text. I wouldn't mind to switch manually, as most of the time I'm either coding (touching only small parts of latex), or writing (leaving the code parts as-is). However, latex mode seems to trip over certain code parts ($ sign in haskell code for example). So it seems it's not smart enough to just ignore code blocks. Probably I need to look into latex mode a bit more, so it becomes off-topic for this list. Thanks for your help Mathijs On Wed, Sep 28, 2011 at 1:27 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 28 September 2011 07:42, Rogan Creswick cresw...@gmail.com wrote: On Tue, Sep 27, 2011 at 11:24 AM, Mathijs Kwik math...@bluescreen303.nl wrote: Hi all, I'm using haskell-mode for emacs and I'm using it to open a literate haskell file which uses latex. This works fine, haskell code has syntax highlighting, and special symbols like lambda get used. However, the latex itself is dull and gree, no highlighting/coloring there. Does anyone know if it's possible to turn on latex highlighting in literate haskell mode? I tried switching to latex-mode, which does the trick (but it chokes on the haskell code inbetween), so I'm pretty sure emacs has everything it needs, but haskell-mode needs to enable this somehow. I'm not certain this /is/ easily in Emacs capabilities. Emacs isn't really set up to support more than one major mode at a time -- there is, however, an extension that can do this. The challenge is defining the start and end of the areas of each 'mode' in the buffer; I've never had very much success, but depending on the delimiters used in the literal haskell syntax you're working with, you may be able to set it up: http://www.emacswiki.org/emacs/MultipleModes There's a more detailed listing at configurations, etc. at: * http://www.haskell.org/haskellwiki/Literate_programming#Multi-mode_support_in_Emacs * haskell-latex.el at http://www.loveshack.ukfsn.org/emacs/ (mentioned in the MultipleModes page on the emacs wiki) But in general, I agree: multiple modes suck in Emacs. I tried all of the available attempts at multiple modes when trying to get Markdown + literate Haskell working, the best I could get was using multi-mode.el (and there are still a few glitches). In general, Emacs tends to go a bit nuts when it's time to switch modes :/ -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] emacs literate haskell mode
On 28 September 2011 16:25, Mathijs Kwik math...@bluescreen303.nl wrote: I tried mmm-mode with a few configurations, but I get into trouble when using other haskell-mode features. Also, the wiki page on haskell-mode ( http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs#Literate_Haskell ) specifically mentions mmm-mode tricks are not needed anymore and shouldn't be used. Its built-in support does a great job to keep all code blocks working the way I want, but the latex parts are just dead text. I wouldn't mind to switch manually, as most of the time I'm either coding (touching only small parts of latex), or writing (leaving the code parts as-is). However, latex mode seems to trip over certain code parts ($ sign in haskell code for example). So it seems it's not smart enough to just ignore code blocks. Probably I need to look into latex mode a bit more, so it becomes off-topic for this list. If you're using AucTeX, there's a way that you can specify that \begin{code}...\end{code} is recognised as a verbatim (i.e. not LaTeX) environment: http://stackoverflow.com/questions/3274091/auctex-emacs-problem-with-character -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] emacs literate haskell mode
On Tue, Sep 27, 2011 at 11:24 AM, Mathijs Kwik math...@bluescreen303.nl wrote: Hi all, I'm using haskell-mode for emacs and I'm using it to open a literate haskell file which uses latex. This works fine, haskell code has syntax highlighting, and special symbols like lambda get used. However, the latex itself is dull and gree, no highlighting/coloring there. Does anyone know if it's possible to turn on latex highlighting in literate haskell mode? I tried switching to latex-mode, which does the trick (but it chokes on the haskell code inbetween), so I'm pretty sure emacs has everything it needs, but haskell-mode needs to enable this somehow. I'm not certain this /is/ easily in Emacs capabilities. Emacs isn't really set up to support more than one major mode at a time -- there is, however, an extension that can do this. The challenge is defining the start and end of the areas of each 'mode' in the buffer; I've never had very much success, but depending on the delimiters used in the literal haskell syntax you're working with, you may be able to set it up: http://www.emacswiki.org/emacs/MultipleModes --Rogan Any help would be great. Greetings, Mathijs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] emacs literate haskell mode
On 28 September 2011 07:42, Rogan Creswick cresw...@gmail.com wrote: On Tue, Sep 27, 2011 at 11:24 AM, Mathijs Kwik math...@bluescreen303.nl wrote: Hi all, I'm using haskell-mode for emacs and I'm using it to open a literate haskell file which uses latex. This works fine, haskell code has syntax highlighting, and special symbols like lambda get used. However, the latex itself is dull and gree, no highlighting/coloring there. Does anyone know if it's possible to turn on latex highlighting in literate haskell mode? I tried switching to latex-mode, which does the trick (but it chokes on the haskell code inbetween), so I'm pretty sure emacs has everything it needs, but haskell-mode needs to enable this somehow. I'm not certain this /is/ easily in Emacs capabilities. Emacs isn't really set up to support more than one major mode at a time -- there is, however, an extension that can do this. The challenge is defining the start and end of the areas of each 'mode' in the buffer; I've never had very much success, but depending on the delimiters used in the literal haskell syntax you're working with, you may be able to set it up: http://www.emacswiki.org/emacs/MultipleModes There's a more detailed listing at configurations, etc. at: * http://www.haskell.org/haskellwiki/Literate_programming#Multi-mode_support_in_Emacs * haskell-latex.el at http://www.loveshack.ukfsn.org/emacs/ (mentioned in the MultipleModes page on the emacs wiki) But in general, I agree: multiple modes suck in Emacs. I tried all of the available attempts at multiple modes when trying to get Markdown + literate Haskell working, the best I could get was using multi-mode.el (and there are still a few glitches). In general, Emacs tends to go a bit nuts when it's time to switch modes :/ -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] '#' in literate haskell
John MacFarlane wrote: Can anyone explain why ghc does not treat the following as a valid literate haskell program? - test.lhs # This is a test foo = reverse . words I believe this is an artifact of ghc trying to parse cpp style line number information: foo.lhs # 123 foo.foo t = will print this error: foo.foo:124:6: parse error on input `' Bertram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] '#' in literate haskell
Can anyone explain why ghc does not treat the following as a valid literate haskell program? - test.lhs # This is a test foo = reverse . words When I try to load this in ghci (or compile it using ghc), I get: test.lhs:1:2: lexical error at character 'T' It seems that the problem is the '#' character in the first column. Replacing it with something else, or moving it to the right one space, solves the problem. The following literate haskell program, from http://notvincenz.blogspot.com/2008/01/literate-haskell-and-c.html, also fails to load for me, for the same reason (the leading '#' in line 8). literate-haskell-and-c.lhs --- /* c and lhs file module Foo where main = print Haskell */ #include int main() { printf(C\n); return 0; } I've reproduced this with ghc 6.10.1 and ghc 6.8.3 (linux binaries from haskell.org) and with ghc 6.8.2 (Ubuntu intrepid). Interestingly, hugs (September 2006 version) has no trouble with test.lhs. I haven't tried ghc 6.6. I care about this because I'd like to use markdown conventions to format the comment parts of literate haskell programs. Markdown supports atx-style headers, which begin with strings of '#' characters starting in the first column. I know that some people use markdown with literate haskell, so there must be something basic here that I'm missing! John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] '#' in literate haskell
# is significant because it can be sh-bang line or pre-processor. The only way I can think of is: alias lhspp=sed 's/^#//' ghc --make -F -pgmF lhspp File.lhs On Sat, Nov 29, 2008 at 10:07 PM, John MacFarlane [EMAIL PROTECTED] wrote: Can anyone explain why ghc does not treat the following as a valid literate haskell program? - test.lhs # This is a test foo = reverse . words When I try to load this in ghci (or compile it using ghc), I get: test.lhs:1:2: lexical error at character 'T' It seems that the problem is the '#' character in the first column. Replacing it with something else, or moving it to the right one space, solves the problem. The following literate haskell program, from http://notvincenz.blogspot.com/2008/01/literate-haskell-and-c.html, also fails to load for me, for the same reason (the leading '#' in line 8). literate-haskell-and-c.lhs --- /* c and lhs file module Foo where main = print Haskell */ #include int main() { printf(C\n); return 0; } I've reproduced this with ghc 6.10.1 and ghc 6.8.3 (linux binaries from haskell.org) and with ghc 6.8.2 (Ubuntu intrepid). Interestingly, hugs (September 2006 version) has no trouble with test.lhs. I haven't tried ghc 6.6. I care about this because I'd like to use markdown conventions to format the comment parts of literate haskell programs. Markdown supports atx-style headers, which begin with strings of '#' characters starting in the first column. I know that some people use markdown with literate haskell, so there must be something basic here that I'm missing! John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: literate Haskell newbie question
cat foo.lhs | grep -e ^ | sed s/^ // Running for the Useless Use of cat Award? A simpler version would be: sed -n -e 's/^//p foo.lhs I don't guarantee that this will work correctly, tho. Maybe sed -n -e 's/^ //p foo.lhs will work better? This said, the OP talked about TeX, so presumably he uses the other format, so maybe a better sed would be: sed -n -e '/^\\begin{code}/,/\\end{code}/{/^\\begin{code}/d;/^\\end{code}/d;p}' foo.lhs -- Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: literate Haskell newbie question
Immanuel Normann schrieb: I am a newbie to literate Haskell and these are my two simple questions: How do I compile a literate haskell file foo.lhs (using ghc-6.6)? The same way, how you would translate foo.hs Is there a tool that translates foo.lhs to foo.hs? there is an unlit program under ghc's libdir (that you usually do not need): /usr/local/lib/ghc-6.6/unlit Cheers Christian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Literate Haskell
Thanks all for your answers! -- Dmitri Pissarenko Software Engineer http://dapissarenko.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe