[Haskell-cafe] Re: Haddock Markup
Jonathan Cast wrote: NB: This example is *precisely* why I will never adopt MathML as an authoring format. Bowing and scraping at the alter of W3C is not worth using such a terrible syntax, not ever. (Indented, that's math mrow msup mix/mi mn2/mn /msup mo+/mo mrow mn4/mn moInvisibleTimes;/mo mix/mi /mrow mo+/mo mn4/mn /mrow /math Which is still unforgivably horrible. I *think* it's trying to say $x^2 + 4x + 4$, but I'm not confident even of that. Yeah, MathML looks like a machine-only format to me, begging the question why they don't use a more compact format. I'm also unconvinced it's actually easier to parse than $x^2 + 4x + 4$.) While parsing is a solved problem in theory, a lot of people use some regular expression kludges or similar atrocities in practice. Writing a proper parser is too complicated if your language doesn't have parser combinators. :) Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haddock Markup
On Fri, 2009-02-13 at 11:08 +0100, Heinrich Apfelmus wrote: Jonathan Cast wrote: NB: This example is *precisely* why I will never adopt MathML as an authoring format. Bowing and scraping at the alter of W3C is not worth using such a terrible syntax, not ever. (Indented, that's math mrow msup mix/mi mn2/mn /msup mo+/mo mrow mn4/mn moInvisibleTimes;/mo mix/mi /mrow mo+/mo mn4/mn /mrow /math Which is still unforgivably horrible. I *think* it's trying to say $x^2 + 4x + 4$, but I'm not confident even of that. Yeah, MathML looks like a machine-only format to me, begging the question why they don't use a more compact format. I'm also unconvinced it's actually easier to parse than $x^2 + 4x + 4$.) While parsing is a solved problem in theory, a lot of people use some regular expression kludges or similar atrocities in practice. Yeah, we even seem to have adopted one of their syntaxen [markdown]. Writing a proper parser is too complicated if your language doesn't have parser combinators. :) Haddock, I believe, is written in a language that does. If MathML output is desired at some point (e.g., if browsers start doing better at rendering it than at rendering images with TeX source-code alt-texts :) the I think Haddock will still be capable of handling a reasonable input language. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Markup
What about making a SoC out of the problem? A mathematical markup language that is easily written as well as valid Haskell, executable within reason, compilable into mathML (think backticks) and would revolutionise the typeset quality of literate programming? -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haddock Markup
On Fri, 13 Feb 2009, Achim Schneider wrote: What about making a SoC out of the problem? A mathematical markup language that is easily written as well as valid Haskell, executable within reason, compilable into mathML (think backticks) and would revolutionise the typeset quality of literate programming? That's what I just proposed in the SoC thread. Thanks for seconding! :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haddock Markup
On Tue, 2009-02-10 at 12:39 +0100, Henning Thielemann wrote: Heinrich Apfelmus schrieb: Henning Thielemann wrote: I want for long to write math formulas in a paper in Haskell. Actually, lhs2TeX can do such transformations but it is quite limited in handling of parentheses and does not support more complicated transformations (transforming prefix notation in infix notation or vice versa with minimal parentheses). I would like to write sumFor [0..n] (\i - i^2) (with sumFor xs f = sum $ map f xs) which is rendered as \sum_{i=0}^{n} i^2 or integrate 1000 (a,b) (\t - f t) to be rendered as \int_a^b f(t) \dif t Neat idea! Can't you do implement this as a DSL? sumFor x xs f = \sum_{ ++ x ++ = ++ head xs ++ }^{ ++ last xs ++ } ++ f x My original idea was to use the formulas in papers both for typesetting and for unit testing. Thus, when you state that a function fulfills a law, that it can be automatically tested by QuickCheck, that this at least true for some instances. The same would be useful for Haddock documentation. I remember that someone proposed to permit Haddock to expose the implementation of some functions as examples or as unit-tests/laws. Now we could extend this idea to allow Haddock not only to expose the implementation of functions, but also to tell Haddock how to render its implementation. If we want to tell haddock how to render an implementation, surely we use a derivative of lhs2tex. It requires minimal markup in the standard case (just spacing for alignment) and has a nice set of standard presentation rules and allows extending that with formatting directives. It would not let you write complex display mode maths like \sum_{i=0}^{n} i^2 but for code, and laws and proofs that look mostly like code it's really nice. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Markup
Heinrich Apfelmus schrieb: Henning Thielemann wrote: I want for long to write math formulas in a paper in Haskell. Actually, lhs2TeX can do such transformations but it is quite limited in handling of parentheses and does not support more complicated transformations (transforming prefix notation in infix notation or vice versa with minimal parentheses). I would like to write sumFor [0..n] (\i - i^2) (with sumFor xs f = sum $ map f xs) which is rendered as \sum_{i=0}^{n} i^2 or integrate 1000 (a,b) (\t - f t) to be rendered as \int_a^b f(t) \dif t Neat idea! Can't you do implement this as a DSL? sumFor x xs f = \sum_{ ++ x ++ = ++ head xs ++ }^{ ++ last xs ++ } ++ f x My original idea was to use the formulas in papers both for typesetting and for unit testing. Thus, when you state that a function fulfills a law, that it can be automatically tested by QuickCheck, that this at least true for some instances. The same would be useful for Haddock documentation. I remember that someone proposed to permit Haddock to expose the implementation of some functions as examples or as unit-tests/laws. Now we could extend this idea to allow Haddock not only to expose the implementation of functions, but also to tell Haddock how to render its implementation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock Markup
Henning Thielemann wrote: I want for long to write math formulas in a paper in Haskell. Actually, lhs2TeX can do such transformations but it is quite limited in handling of parentheses and does not support more complicated transformations (transforming prefix notation in infix notation or vice versa with minimal parentheses). I would like to write sumFor [0..n] (\i - i^2) (with sumFor xs f = sum $ map f xs) which is rendered as \sum_{i=0}^{n} i^2 or integrate 1000 (a,b) (\t - f t) to be rendered as \int_a^b f(t) \dif t Neat idea! Can't you do implement this as a DSL? sumFor x xs f = \sum_{ ++ x ++ = ++ head xs ++ }^{ ++ last xs ++ } ++ f x Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe