Re: [Haskell-cafe] On Markdown in Haddock and why it's not going to happen

2013-09-02 Thread John MacFarlane
When the proposal was first being discussed, I suggested that instead of
adding markdown support to haddock, one might enhance the existing
haddock markup, making it more expressive, so that it could encode the same
range of structural features as markdown.  If I'm not mistaken, currently
haddock doesn't allow list items with multiple paragraphs or other block
elements, or nested lists, or images, or blockquotes.  This makes it
impossible to create a pandoc writer for haddock markup (we already have a
haddock reader, soon to be released).

With a pandoc writer for haddock, one could write longer documentation sections
(e.g. tutorials) in markdown and convert them to haddock for inclusion in
source code.  This should help people who don't like haddock markup or don't
want to learn it.  With the reader, haddock comments can already be converted
into other formats.

I haven't been following your work, but do I understand correctly
that you've been making haddock markup more expressive and rational?
Has this gotten to the point where a pandoc writer would be feasible?

John

+++ Mateusz Kowalczyk [Aug 30 13 02:30 ]:
 Greetings café,
 
 Perhaps some saddening news for Markdown fans out there. As you might
 remember, there was a fair amount of push for having Markdown as an
 alternate syntax for Haddock.
 
 Unfortunately, this is probably not going to happen for reasons listed
 on the post I just published at [1].
 
 This thread is meant to be for discussion about the post as many people,
 myself included, felt that Markdown would be a nice thing to have.
 
 I feel like I covered the topic fairly well on the post but feel free to
 give suggestions or ask questions.
 
 I would also like to remind you that if there's something that you'd
 like to see in Haddock or something that you feel is broken, a good way
 express this is to make a ticket on the Haddock Trac[2].
 
 I will close the relevant Markdown ticket on the Trac[3] in about 3
 days, unless someone can come up with a reasonable solution that meets
 the initial intent of this part of the project: a widely known markup
 format that could be used as an alternate syntax for Haddock so that
 it's possible to write the documentation without learning the vanilla
 syntax itself.
 
 [1]:
 http://fuuzetsu.co.uk/blog/posts/2013-08-30-why-Markdown-in-Haddock-can't-happen.html
 
 [2]: http://trac.haskell.org/haddock
 
 [3]: http://trac.haskell.org/haddock/ticket/244
 -- 
 Mateusz K.
 
 ___
 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] Fw: Re: On Markdown in Haddock and why it's not going to happen

2013-09-02 Thread John MacFarlane
+++ Mateusz Kowalczyk [Sep 02 13 21:34 ]:
 On 02/09/13 19:43, John MacFarlane wrote:
  When the proposal was first being discussed, I suggested that instead of
  adding markdown support to haddock, one might enhance the existing
  haddock markup, making it more expressive, so that it could encode the same
  range of structural features as markdown.  If I'm not mistaken, currently
  haddock doesn't allow list items with multiple paragraphs or other block
  elements, or nested lists, or images, or blockquotes.  
 Paragraph level elements are indeed not allowed in lists. The list
 contents are currently (that is, on my working branch) allowed to be:
 monospace (delimited by @), anchors, identifiers, module names,
 pictures, URLs, bold, emphasis, HTML escape codes, regular strings. Note
 that if a monospaced string is the only element of the list content, it
 gets turned into a code block.
 
 I'm not sure what you mean by block elements.

I mean things like paragraphs, blockquotes, code blocks, other lists.

In markdown you can have a list item that contains these things:

1.  This is my first list item.

Second paragraph of first list item. Some code:

foo = bar $ baz * 2.0

2.  This is my second list item.

* Sublist item one
* Sublist item two

3.  This is my third list item.  Someone said:

 We want markdown support in haddock!

In Haddock, last I looked, you couldn't do any of this...

In your original message, you emphasized features of Haddock that
don't exist in standard markdown and would require extensions
(definition lists, automatic links to Haskell identifiers, etc.).

But in many other ways, markdown is much more expressive than
Haddock markup, as the example above illustrates.  The changes that
would be needed to Haddock to allow it to express what can be expressed
in markdown are much bigger, I think, than the changes that would be
needed to markdown to allow it to express what can be expressed in
Haddock.



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] bug in Data.ByteString.Lazy or in me?

2013-07-03 Thread John MacFarlane
On a 64-bit Windows 8 server EC2 instance, with Haskell Platform
freshly installed from the package installer,

GHCI :m + Data.ByteString.Lazy
GHCI Data.ByteString.Lazy.hGetContents stdin

gives me an immediate error hGetBufSome: resource exhausted (Not enough
space), while

GHCI :m + Data.ByteString
GHCI Data.ByteString.hGetContents stdin

waits for user input, as expected.

On 32-bit Windows, both work as expected.

Can anyone explain this?  Is this a bug in bytestring?

John


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] text-icu on Windows

2013-04-27 Thread John MacFarlane
Hello café:

I'd very much like to get text-icu working on Windows, as then I could ship
pandoc binaries that do proper unicode collation in bibliographies.  But I'm
having a devil of a time.  This may be due to my very limited Windows
knowledge.  Any help would be appreciated, especially from someone who actually
has text-icu working on Windows.

I was able to cabal install text-icu without errors. I used --extra-lib-dirs
and --extra-include-dirs to point to the lib and include directories in the
32-bit binary distribution of icu4c.  I'm using the latest Haskell Platform,
2012.4.0.0 with ghc 7.4.2.

I was also able to build the following simple program that uses text-icu, by
doing ghc --make icu.hs:

~~~
-- icu.hs
import Data.Text.ICU
main = print $ Locale tr-TR
~~~

No errors or warnings in either of these steps. But when I try to run the
compiled program, icu.exe, I get no output at all. I expected to get a line
with 'Locale tr-TR', but instead I get nothing -- not even an error or 
warning.
This remains the case if I try

~~~
main = do
  print Start
  print $ Locale tr-TR
  print Done
~~~

'echo $?' yields False.

Any ideas?

John

(I've posted a similar question to StackOverflow [1], but it hasn't gotten
an answer yet there, so I thought I'd try here.)

[1]: 
http://stackoverflow.com/questions/16127710/how-do-i-get-text-icu-working-on-windows)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Markdown extension for Haddock as a GSoC project

2013-04-27 Thread John MacFarlane
I agree with Chris that it would be better to have a standard syntax for
Haskell documentation.  Especially if the alternative is ten different
markup languages. (Remember, all of these need to be supported in
haddock, which is a basic piece of infrastructure.)

Here's a thought.  Instead of adding support for markdown, why not
enhance the existing haddock markup, making it more expressive, so that
it could encode the same range of structural features as markdown?

If this were done, we could add a haddock writer to pandoc.  There is
already a haddock reader in the development version, but a writer is
difficult because haddock is so much less expressive than other formats.
For example, unless I'm mistaken, it doesn't allow list items with
multiple paragraphs or other block elements, or nested lists, or images,
or blockquotes.

With a pandoc reader and writer for haddock, it would be easy to write
your documentation in any format you choose (several variants of
markdown, reST, textile, LaTeX, HTML, mediawiki) and produce equivalent
haddock markup to paste into the source file.

It would also be easy to convert the documentation in your source file
to any of the formats supported by pandoc.  So, you could generate a man
page from your haddock markup, or a web page or blog entry, or a LaTeX
document.

It seems to me that this would provide most of the advantages people
who want a markdown extension for haddock are looking for.  But it would
not require taking sides in markdown/reST/asciidoc/creole wars,
and it would not lead to the fragmentation of documentation formats
in Haskell source code.  If the extensions to haddock markup were done
carefully, it wouldn't even require a special PRAGMA, since all existing
markup would have the same interpretation in the extended markup.

John

+++ Chris Smith [Apr 27 13 12:05 ]:
I don't agree with this at all. Far more important than which
convention gets chosen is that Haskell code can be read and written
without learning many dialects of Haddock syntax. I see an API for
pluggable haddock syntax as more of a liability than a benefit. Better
to just stick to what we have than fragment into more islands.
 
I do think that changing Haddock syntax to include common core pieces
of Markdown could be a positive change... but not if it spawns a battle
of fragmented documentation syntax that lasts a decade.
On Apr 27, 2013 11:08 AM, Bryan O'Sullivan [3]b...@serpentine.com
wrote:
 
On Sat, Apr 27, 2013 at 2:23 AM, Alistair Bayley
[4]alist...@abayley.org wrote:
 
How's about Creole?
[5]http://wikicreole.org/
Found it via this:
[6]http://www.wilfred.me.uk/blog/2012/07/30/why-markdown-is-not-my-favo
urite-language/
If you go with Markdown, I vote for one of the Pandoc implementations,
probably Pandoc (strict):
[7]http://johnmacfarlane.net/babelmark2/
(at least then we're not creating yet another standard...)
 
Probably the best way to deal with this is by sidestepping it: make the
support for alternative syntaxes as modular as possible, and choose two
to start out with in order to get a reasonable shot at constructing a
suitable API.
I think it would be a shame to bikeshed on which specific syntaxes to
support, when a lot of productive energy could more usefully go into
actually getting the work done. Better to say prefer a different
markup language? code to this API, then submit a patch!
 
  ___
  Haskell-Cafe mailing list
  [8]Haskell-Cafe@haskell.org
  [9]http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 References
 
1. mailto:cdsm...@gmail.com
2. mailto:b...@serpentine.com
3. mailto:b...@serpentine.com
4. mailto:alist...@abayley.org
5. http://wikicreole.org/
6. 
 http://www.wilfred.me.uk/blog/2012/07/30/why-markdown-is-not-my-favourite-language/
7. http://johnmacfarlane.net/babelmark2/
8. mailto:Haskell-Cafe@haskell.org
9. 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] text-icu on Windows

2013-04-27 Thread John MacFarlane
Ryan,

Many thanks for your reply.  I was assuming ghc would statically link
against the library files instead of relying on the dll's.  I will see
if I can build the library from source under mingw.  An alternative
would be to distribute the needed dlls with the binary.

John

+++ Ryan Yates [Apr 27 13 19:53 ]:
Hi John,
 
I just tried this out and if I copied all of the .dll files from the
icu4c bin folder into the same folder as the test icu.exe it works as
expected. You can see what dlls are missing with the dependency walker
program[1]http://www.dependencywalker.com/. Perhaps with a mingw based
build of icu4c (the one I used said it was built with Visual Studio 10)
you could avoid this.
 
Ryan Yates
On Sat, Apr 27, 2013 at 4:56 PM, John MacFarlane [2]j...@berkeley.edu
wrote:
 
  Hello caf:
  I'd very much like to get text-icu working on Windows, as then I
  could ship
  pandoc binaries that do proper unicode collation in bibliographies.
  But I'm
  having a devil of a time. This may be due to my very limited Windows
  knowledge. Any help would be appreciated, especially from someone
  who actually
  has text-icu working on Windows.
  I was able to cabal install text-icu without errors. I used
  --extra-lib-dirs
  and --extra-include-dirs to point to the lib and include directories
  in the
  32-bit binary distribution of icu4c. I'm using the latest Haskell
  Platform,
  2012.4.0.0 with ghc 7.4.2.
  I was also able to build the following simple program that uses
  text-icu, by
  doing ghc --make icu.hs:
  ~~~
  -- icu.hs
  import Data.Text.ICU
  main = print $ Locale tr-TR
  ~~~
  No errors or warnings in either of these steps. But when I try to
  run the
  compiled program, icu.exe, I get no output at all. I expected to get
  a line
  with 'Locale tr-TR', but instead I get nothing -- not even an
  error or warning.
  This remains the case if I try
  ~~~
  main = do
  print Start
  print $ Locale tr-TR
  print Done
  ~~~
  'echo $?' yields False.
  Any ideas?
  John
  (I've posted a similar question to StackOverflow [1], but it hasn't
  gotten
  an answer yet there, so I thought I'd try here.)
  [1]:
  [3]http://stackoverflow.com/questions/16127710/how-do-i-get-text-icu
  -working-on-windows)
  ___
  Haskell-Cafe mailing list
  [4]Haskell-Cafe@haskell.org
  [5]http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 References
 
1. http://www.dependencywalker.com/
2. mailto:j...@berkeley.edu
3. 
 http://stackoverflow.com/questions/16127710/how-do-i-get-text-icu-working-on-windows
4. mailto:Haskell-Cafe@haskell.org
5. 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-08 Thread John MacFarlane
+++ John MacFarlane [Apr 05 13 16:04 ]:
 I like markdown and use it all the time.  While I acknowledge the
 problems that have been pointed out, markdown has the advantage of being
 easily readable as it is in the source document, and not looking like
 markup.
 
 But I do want to point out one problem with markdown as a format for
 documentation in Haskell files.  Consider:
 
 
 module MyModule
 {-
 # Introduction
 
 This is my module
 -}
 where
 import System.Environment
 
 main = getArgs = print
 
 
 Now try to compile with -cpp, and you'll get an error because of the '#'
 in column 1.  '#' in column 1 is common in markdown (and even
 indispensible for level 3+ headers).
 
 One could work around this by disallowing level 3+ headers, by allowing
 the headers to be indented, or by introducing new setext-like syntax for
 level 3+ headers, but it is a problem for the idea of using a markdown
 SUPERset.
 
 John

Let me amplify my original comment with one more observation about
problems using markdown to comment Haskell code.

Markdown blockquotes start with '' (usually in the leftmost column).
But this causes problems when your source document is bird-style
literate Haskell:

--
This is my literate Haskell module.  As
someone said:

 literate Haskell is great!

Oops, that will be interpreted by GHC
as code, not comment.

 main = print $ reverse [1,2]
--

You can work around this by indenting the first '' one space, which is
still valid Markdown, but it's a bit awkward.  Obviously, we'd want any
Haddock markup successor to work in literate Haskell too.

reStructuredText has fewer potential conflicts and might be a more
sensible choice.  But one would need to write a correct parser for
it.  The pandoc parser doesn't cover 100% of rST, and differs in other
ways from the docutils parser (e.g. it allows markup inside links).
For full compatibility you'd probably want to copy the python module's
parsing algorithm exactly.

John


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-05 Thread John MacFarlane
I like markdown and use it all the time.  While I acknowledge the
problems that have been pointed out, markdown has the advantage of being
easily readable as it is in the source document, and not looking like
markup.

But I do want to point out one problem with markdown as a format for
documentation in Haskell files.  Consider:


module MyModule
{-
# Introduction

This is my module
-}
where
import System.Environment

main = getArgs = print


Now try to compile with -cpp, and you'll get an error because of the '#'
in column 1.  '#' in column 1 is common in markdown (and even
indispensible for level 3+ headers).

One could work around this by disallowing level 3+ headers, by allowing
the headers to be indented, or by introducing new setext-like syntax for
level 3+ headers, but it is a problem for the idea of using a markdown
SUPERset.

John

+++ dag.odenh...@gmail.com [Apr 05 13 21:59 ]:
I forgot the mention the craziness with the *significant trailing
whitespace*.
 
On Fri, Apr 5, 2013 at 9:49 PM, [1]dag.odenh...@gmail.com
[2]dag.odenh...@gmail.com wrote:
 
Personally I think Markdown sucks, although perhaps less than Haddock
markup.
Still:
* No document meta data
* No code block meta data like language for syntax highlighting
* No tables
* No footnotes
* HTML fallback is insecure
* Confusing syntax (is it []() or ()[] for links?)
* Syntax that gets in the way (maybe I don't want *stars* emphasized)
* Above point leads to non-standard dialects like GitHub Markdown
(no, GitHub doesn't use markdown)
* Not extensible, leading to even more non-standard hacks and
work-arounds (GitHub Markdown, Pandoc Markdown, other Markdown
libraries have their own incompatible extensions)
* Not well suited for web input (e.g. four-space indentation for code
blocks), although not that important for Haddock
An important thing to note here is that no, Markdown has *not* won
because no one is actually using *Markdown*. They're using their own,
custom and incompatible dialects.
Only two of the above points apply to reStructuredText (web input and
syntax getting in the way), and those particular points don't apply to
Creole. Therefore I tend to advocate Creole for web applications and
reStructuredText for documents.
On Thu, Apr 4, 2013 at 6:49 PM, Johan Tibell
[3]johan.tib...@gmail.com wrote:
 
  Hi all,
  Haddock's current markup language leaves something to be desired
  once
  you want to write more serious documentation (e.g. several
  paragraphs
  of introductory text at the top of the module doc). Several features
  are lacking (bold text, links that render as text instead of URLs,
  inline HTML).
  I suggest that we implement an alternative haddock syntax that's a
  superset of Markdown. It's a superset in the sense that we still
  want
  to support linkifying Haskell identifiers, etc. Modules that want to
  use the new syntax (which will probably be incompatible with the
  current syntax) can set:
  {-# HADDOCK Markdown #-}
  on top of the source file.
  Ticket: [4]http://trac.haskell.org/haddock/ticket/244
  -- Johan
  ___
  Haskell-Cafe mailing list
  [5]Haskell-Cafe@haskell.org
  [6]http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 References
 
1. mailto:dag.odenh...@gmail.com
2. mailto:dag.odenh...@gmail.com
3. mailto:johan.tib...@gmail.com
4. http://trac.haskell.org/haddock/ticket/244
5. mailto:Haskell-Cafe@haskell.org
6. 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-04 Thread John MacFarlane
+++ Simon Heath [Apr 04 13 13:04 ]:
 I humbly suggest reStructuredText rather than Markdown, which is what
 is used by the Python community for documentation.  Since it's specifically
 made for documentation it may be nicer.  But, I don't want to spark
 a format argument.
 
 There is also the Pandoc program, which is a universal-ish markup-
 language-converter, conveniently written in Haskell.  Might be a place
 to start for this, regardless of the language chosen:
 http://www.johnmacfarlane.net/pandoc/
 
 Simon

(Pandoc author here.) It probably wouldn't make sense for a key
infrastructure component like Haddock to depend on a behemoth like
pandoc.  But I could help out with a markdown-superset parser if needed.
I have an experimental thing here that could be used as a basis (it's 7x
faster than pandoc and uses 1/5 the memory, BSD licensed):
https://github.com/jgm/Markdown

Another idea: If someone contributed a Haddock markup writer to pandoc,
then documentation could be written in markdown (or RST or whatever) and
converted automatically to standard Haddock markup.  David Lazar has
recently contributed a Haddock markup reader, but there is no writer.

Note: Creating a writer would be a bit tricky, because Haddock markup
isn't expressive enough for many of the constructions pandoc allows --
for example, if I'm not mistaken, you can't have multiple paragraphs
inside list items.  Decisions would have to be made about how to deal
with such cases.  There are also a few Haddock constructions that don't
correspond to anything in pandoc.

John


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Input and output of mathematical expressions

2011-06-09 Thread John MacFarlane
There's also http://hackage.haskell.org/package/texmath
which converts LaTeX to MathML, and even handles LaTeX
macros.  The problem is that MathML support in browsers
is still spotty.

http://hackage.haskell.org/packages/archive/texmath/0.5.0.1/doc/html/Text-TeXMath-Types.html
contains types for representing formulas in Haskell.

John

+++ Daniel Patterson [Jun 09 11 11:04 ]:
(I originally sent this reply from the wrong address, see below)
 
On Jun 9, 2011, at 11:03 AM, Daniel Patterson wrote:
 
Also if you are doing this for web, I haven't used it personally (yet),
but [1]http://www.mathjax.org/ looks really good... would allow you to
actually just write it in LaTeX (as writing MathML by hand is not
something I'd like to subject anyone to).
On Jun 9, 2011, at 10:59 AM, Chris Smith wrote:
 
  Ae you looking to do this in a web application, or client-side?
  Since one of your requirements is to display a typeset equation,
  that makes a bit of difference.  In a web-based setting, the best
  way to do that is probably MathML, whereas a GUI will be a bit
  harder.
 
On Jun 9, 2011 8:24 AM, Jacek Generowicz
[2]jacek.generow...@cern.ch wrote:
 Greetings Cafe,

 What would you recommend as a Haskell-based means of interactively
 reading and writing mathematical formulae?

 As a toy example, what might I use to write a program which presents
 the user with

 Please simplify the expression: \pi x^2 + 3\pi x^2

 (Where the TeX-style expression would be presented with a greek pi
and
 superscript twos on the xs.)

 The user should then have the ability to reply with something that
 looks like the result of TeXing

 5 \pi x^2

 Whatever means the user uses to enter this expression, he should be
 able to preview the typeset version of his input before submitting.

 Any ideas?

 Thanks.


 ___
 Haskell-Cafe mailing list
 [3]Haskell-Cafe@haskell.org
 [4]http://www.haskell.org/mailman/listinfo/haskell-cafe
 
  ___
  Haskell-Cafe mailing list
  [5]Haskell-Cafe@haskell.org
  [6]http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 References
 
1. http://www.mathjax.org/
2. mailto:jacek.generow...@cern.ch
3. mailto:Haskell-Cafe@haskell.org
4. http://www.haskell.org/mailman/listinfo/haskell-cafe
5. mailto:Haskell-Cafe@haskell.org
6. 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskellwiki slow/unresponsive

2011-06-08 Thread John MacFarlane
+++ Gwern Branwen [Jun 06 11 17:47 ]:
 On Mon, Jun 6, 2011 at 4:45 PM, Greg Weber g...@gregweber.info wrote:
 
  Gitit uses darcs or git to store data, but through the command line
  interfaces. Unfortunately to my knowledge darcs does not expose a library
  interface. Gitit could be made faster and more secure by interfacing with
  libgit2.
 
 Darcs does export a library and pretty much has ever since I first
 cabalized it; see http://hackage.haskell.org/package/darcs for the
 module listings. It's not a very useful API, however. I don't know how
 to use it, and John doesn't know how to use libgit2, I suspect.

I haven't had much time to work on gitit + filestore lately, and I'll
have even less in the future.  I'd rather focus my programming time on
pandoc.  So I'd be game if someone wanted to take the project in a new
direction.

Looks as if there are already Haskell bindings to libgit2:
http://hackage.haskell.org/packages/archive/hlibgit2
A first step might be rewriting filestore to use libgit and libdarcs
instead of shelling out to the programs.

It also might be nice to create a filestore instance that uses a
persistent in-memory datastore like acid-state; this would be very fast,
and appropriate for a wiki (like hawiki) with mostly textual content.

I would also not object to a rewrite using Yesod -- the type-safe URLs
and the support for subsites would both be really useful in gitit.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] is datetime actively maintained?

2011-01-17 Thread John MacFarlane
I've already modified the dev versions of filestore and gitit so
they don't depend on datetime. This should solve the problem. I
expect to be releasing new versions of both before long.

John

+++ Max Bolingbroke [Jan 17 11 07:50 ]:
 Hi,
 
 I also wanted to build gitit on Windows and encountered the datetime
 issue. I sent the maintainer (Eric Sessoms) a request to bump his
 version bounds on the 22nd December, but haven't received a reply. (I
 had to bump a lot of other gitit version bounds, but those bumps
 *have* been taken upstream)
 
 I'm not sure what to do in a situation like this - since Hackage has
 no security I could just upload a new version of datetime with the
 bumped bounds, but this hardly seems polite, and I'm not really keen
 on maintaining datetime long term. The change would also be lost if
 Eric decides to upload a new version of his own.
 
 Cheers,
 Max
 
 On 17 January 2011 02:05, Carter Schonwald carter.schonw...@gmail.com wrote:
  Hey All,
  I can't tell if datetime is actively maintained, and its version constraints
  need to be adjusted to allow base4 (which would then allow a whole mess of
  other packages including gitit build under ghc7). I've been sucessful
   building gitit with ghc7 64 on OS X and using it if that one constraint on
  datetime  is modified.
  any thoughts?
  cheers,
  -Carter
 
 
  ___
  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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: zip-archive performance/memmory usage

2010-08-10 Thread John MacFarlane
Hi all,

I'm the author of zip-archive. I wrote it for a fairly special purpose --
I wanted to create and read ODT files in pandoc -- and I know it could be
improved.

The main problem is that the parsing algorithm is kind of stupid; it just
reads the whole archive in sequence, storing the files as it comes to them.
So a file listing will take almost as much time as a full extract.

There's a better way: The zip archive ends with an end of central directory
record, which contains (among other things) the offset of the central
directory from the beginning of the file. So, one could use something like the
following strategy:

1. read the end of central directory record, which should be the last 22
bytes of the file. I think it should be possible to do this without allocating
memory for the whole file.

2. parse that to determine the offset of the central directory.

3. seek to the offset of the central directory and parse it. This will give
you a list of file headers. Each file header will tell you the name of a file
in the archive, how it is compressed, and where to find it (its offset) in the
file.

At this point you'd have the list of files, and enough information to seek to
any file and read it from the archive. The API could be changed to allow lazy
reading of a single file without reading all of them.

I don't think these changes would be too difficult, since you wouldn't have to
change any of the functions that do the binary parsing -- it would just be a
matter of changing the top-level functions.

I don't have time to do this right now, but if one of you wants to tackle the
problem, patches are more than welcome! There's some documentation on the ZIP
format in comments in the source code.

John


+++ Neil Brown [Aug 10 10 12:35 ]:
 On 10/08/10 00:29, Pieter Laeremans wrote:
 Hello,
 
 I'm trying some haskell scripting. I'm writing a script to print
 some information
 from a zip archive.  The zip-archive library does look nice but
 the performance of zip-archive/lazy bytestring
 doesn't seem to scale.
 
 Executing :
 
eRelativePath $ head $ zEntries archive
 
 on an archive of around 12 MB with around 20 files yields
 
 Stack space overflow: current size 8388608 bytes.
 
 
 The script in question can be found at :
 
 http://github.com/plaeremans/HaskellSnipplets/blob/master/ZipList.hs
 
 I'm using the latest version of haskell platform.  Are these
 libaries not production ready,
 or am I doing something terribly wrong ?
 
 I downloaded your program and compiled it (GHC 6.12.1, zip-archive
 0.1.1.6, bytestring 0.9.1.5).  I ran it on the JVM src.zip (20MB,
 ~8000 files) and it sat there for a minute (67s), taking 2.2% memory
 according to top, then completed successfully.  Same behaviour with
 -O2.  Which compares very badly in time to the instant return when I
 ran unzip -l on the same file, but I didn't see any memory problems.
 Presumably your archive is valid and works with unzip and other
 tools?
 
 Thanks,
 
 Neil.
 
 ___
 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] ANNOUNCE: highlighting-kate 0.2.7

2010-07-16 Thread John MacFarlane
I'm pleased to announce a new release of highlighting-kate [1],
a syntax highlighting library based on syntax definitions from
the kate editor.

!! Important note !! The new release uses new, two-letter class names in
its HTML output. If you use highlighting-kate, you will need to
update your css files. Three sample css files can be found in the css
directory of the source.

This release also incorporates improvements to the kate syntax
definition for Haskell by Nicolas Wu.

There are two minor API changes:

1.  A new function, languagesByFilename, has been added.  This will
give better results than languagesByExtension for things like
Makefile or CMake.txt.

2.  A new formatting option, OptDetailed, has been added.  Use this
only if you need access to detailed, language-specific lexical
information, and not generic styles.

[1]:  http://hackage.haskell.org/package/highlighting-kate

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] ANNOUNCE: highlighting-kate 0.2.7

2010-07-16 Thread John MacFarlane
I'm pleased to announce a new release of highlighting-kate [1],
a syntax highlighting library based on syntax definitions from
the kate editor.

!! Important note !! The new release uses new, two-letter class names in
its HTML output. If you use highlighting-kate, you will need to
update your css files. Three sample css files can be found in the css
directory of the source.

This release also incorporates improvements to the kate syntax
definition for Haskell by Nicolas Wu.

There are two minor API changes:

1.  A new function, languagesByFilename, has been added.  This will
give better results than languagesByExtension for things like
Makefile or CMake.txt.

2.  A new formatting option, OptDetailed, has been added.  Use this
only if you need access to detailed, language-specific lexical
information, and not generic styles.

[1]:  http://hackage.haskell.org/package/highlighting-kate

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] new syntax highlighting library (lexers wanted!)

2010-03-03 Thread John MacFarlane
Cafe:

I wanted to let you know about a new syntax highlighting library
I've been working on, called 'illuminate'.  The (BSD3 licensed) code
is on github: http://github.com/jgm/illuminate

illuminate is meant eventually to replace my other highlighting library,
highlighting-kate, which is too big, slow, and memory-hungry.
In my benchmarks, illuminate is around 70X faster than highlighting-kate
and uses half the memory. It can produce output in ANSI, HTML, XHTML,
and LaTeX.  Highlighting styles can be defined independently of any
output format.

So far I've written lexers for haskell, literate haskell, cabal,
alex, c, c++, c#, python, ruby, java, html, rhtml, xml, javascript, css,
tex, and bibtex.  Want to highlight a language not on this list?  Why
not help out by writing a lexer? (Study the lexer for a similar language
to get started; if you aren't familiar with Alex, you may want to look
at the Alex User Guide too. And let me know if you have any questions.)

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: pandoc code bocks not working

2010-02-16 Thread John MacFarlane
Why don't you direct your pandoc-related questions to the pandoc-discuss
mailing list?  http://groups.google.com/group/pandoc-discuss

In this case, it would also be helpful to have more information -- such
as a sample input file and instructions on how to reproduce the
problem you're seeing.  (I've been using pandoc compiled with GHC 6.12
without problems.)

John

+++ Anatoly Yakovenko [Feb 16 10 12:17 ]:
 Thanks, that solved it.
 
 I am also seening that pandoc compiled with 6.12 seems to barf on the
 .css file that is used in the examples.
 
 
 commitAndReleaseBuffer: invalid argument (Invalid or incomplete
 multibyte or wide character)
 
 
 On Sun, Feb 14, 2010 at 5:48 PM, Walter De Jonge w...@skynet.be wrote:
  http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
 
  Like regular code blocks, delimited code blocks must be separated from
  surrounding text by blank lines.
 
  goodluck
 
  walter
  ___
  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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Design question, HTML for GUIs?

2010-01-10 Thread John MacFarlane
+++ Günther Schmidt [Jan 10 10 19:38 ]:
 Hi everyone,
 
 as probably most people I find the GUI part of any application to be
 the hardest part.
 
 It just occurred to me that I *could* write my wxHaskell desktop
 application as a web app too.
 
 When the app starts, a haskell web server start listening on
 localhost port 8080 for example and I fire up a browser to page
 localhost:8080 without the user actually knowing too much about it.
 
 Is that a totally stupid idea?
 Which haskell web servers would make good candidates?
 Are there any *continuation* based web server in haskell, something
 similar to Smalltalk's Seaside?

Happstack is not continuation based, but Chris Eidhof shows how to use
Happstack with continuations here: http://gist.github.com/260052 

And Chris Smith has built a package:
http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/package/happstack-dlg-0.1.1

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Optimizing Parsec 3 -- was: Wiki software?

2009-12-05 Thread John MacFarlane
+++ Howard B. Golden [Dec 05 09 13:36 ]:
 On Friday December 4, 2009, John MacFarlane wrote:
 
  I used criterion to compare pandoc compiled with parsec2 to
  pandoc compiled with your version of parsec3.  (The benchmark
  is converting testsuite.txt from markdown to HTML.) The difference
   was minor:
  
  parsec2:
  mean: 67.66576 ms, lb 67.56722 ms, ub 67.88983 ms, ci 0.950
  std dev: 722.3878 us, lb 323.0343 us, ub 1.356013 ms, ci 0.950
  
  parsec3:
  mean: 68.20847 ms, lb 68.16387 ms, ub 68.26284 ms, ci 0.950
  std dev: 252.7773 us, lb 204.5512 us, ub 325.2424 us, ci 0.950
  
  So, once you release the new parsec3, I am prepared to remove the
  parsec  3 restriction from the libraries I maintain: pandoc,
  highlighting-kate, filestore, gitit, and yst.
 
 I don't know what the performance of the current parsec3 is compared to 
 parsec2. It would be helpful if you could run your benchmark for that 
 also and include it.

parsec 2.1.0.1 from HackageDB:
mean: 67.71456 ms, lb 67.65181 ms, ub 67.82660 ms, ci 0.950
std dev: 416.1303 us, lb 274.0063 us, ub 761.6995 us, ci 0.950

parsec 3.0.1 from HackageDB:
mean: 188.5380 ms, lb 188.3217 ms, ub 188.7615 ms, ci 0.950
std dev: 1.136199 ms, lb 964.3489 us, ub 1.366720 ms, ci 0.950

parsec 3.0.1 from Antoine:
mean: 69.29665 ms, lb 69.22450 ms, ub 69.48016 ms, ci 0.950
std dev: 551.3562 us, lb 263.7954 us, ub 1.156183 ms, ci 0.950

 If the only issue is performance, I respectfully request that you remove 
 the parsec  3 requirement even before the new version of parsec3 is 
 released. Thank you.

Sorry, I don't want to do that. Lots of people have both parsec-2 and
parsec-3 installed, and if I remove the restriction, their pandoc (and
gitit and...) will be much slower unless they take special steps.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Optimizing Parsec 3 -- was: Wiki software?

2009-12-04 Thread John MacFarlane
 On Mon, Nov 23, 2009 at 12:29 PM, Antoine Latter aslat...@gmail.com wrote:
 
 I finally had some time to test it.  After running it multiple times
 (of course, it would be nice to use criterion here), I'm getting
 numbers in this neighborhood:
 

I used criterion to compare pandoc compiled with parsec2 to
pandoc compiled with your version of parsec3.  (The benchmark
is converting testsuite.txt from markdown to HTML.) The difference was
minor:

parsec2:
mean: 67.66576 ms, lb 67.56722 ms, ub 67.88983 ms, ci 0.950
std dev: 722.3878 us, lb 323.0343 us, ub 1.356013 ms, ci 0.950

parsec3:
mean: 68.20847 ms, lb 68.16387 ms, ub 68.26284 ms, ci 0.950
std dev: 252.7773 us, lb 204.5512 us, ub 325.2424 us, ci 0.950

So, once you release the new parsec3, I am prepared to remove the
parsec  3 restriction from the libraries I maintain: pandoc,
highlighting-kate, filestore, gitit, and yst.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Wiki software?

2009-11-21 Thread John MacFarlane
+++ Gwern Branwen [Nov 21 09 11:38 ]:
 On Sat, Nov 21, 2009 at 11:14 AM, Vladimir Ivanov
 vladimir.v.iva...@gmail.com wrote:
  I decided to give orchid a try, but failed to install the latest
  version (0.0.8) using cabal.
 
  The reason is that one of the dependencies (filestore) depends on
  parsec-2.0.* and orchid requires parsec3. I installed filestore-0.2
  separately, but nothing changed.
 
  $ cabal install orchid
  Resolving dependencies...
  cabal: cannot configure filestore-0.2. It requires parsec ==2.*
  For the dependency on parsec ==2.* there are these packages: parsec-2.0,
  parsec-2.1.0.0 and parsec-2.1.0.1. However none of them are available.
  parsec-2.0 was excluded because orchid-0.0.8 requires parsec ==3.0.*
  parsec-2.1.0.0 was excluded because orchid-0.0.8 requires parsec ==3.0.*
  parsec-2.1.0.1 was excluded because orchid-0.0.8 requires parsec ==3.0.*
 
  $ ghc-pkg list filestore
  /usr/lib64/ghc-6.10.1/./package.conf:
  ~/.ghc/x86_64-linux-6.10.1/package.conf:
     filestore-0.2, filestore-0.3.2, filestore-0.3.3
 
  $ ghc-pkg list parsec
  /usr/lib64/ghc-6.10.1/./package.conf:
     parsec-2.1.0.1, parsec-3.0.0
 
  $ cabal --version
  cabal-install version 0.6.2
  using version 1.6.0.2 of the Cabal library
 
  Have you seen this before?
  I hope I overlooked something trivial... =)
 
  -- vi
 
 Apparently you can build filestore with parsec-3 if you want.
 Data/FileStore/Git.hs doesn't seem to use any of the functionality
 that changed between 2  3. I swapped the dep:
 
  hunk ./filestore.cabal 35
  - parsec = 2   3, process, time,
 datetime, regex-posix, xml, split, Diff
  + parsec = 3, process, time, datetime,
 regex-posix, xml, split, Diff
 
 Configured, noticing what parsec was being used:
 
  Dependency parsec =3: using parsec-3.0.0
 
 Built  installed successfully.

This is a bit of a problem.  gitit requires parsec = 2   3,
so gitit needs filestore to depend on parsec-2.  The reason why
is that pandoc depends on parsec-2, and the reason pandoc depends
on parsec-2 is that parsec-2 is significantly faster than parsec-3.
(I've verified this with several benchmarks, and so have others.)

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: gitit 0.6.1

2009-08-25 Thread John MacFarlane
I'm pleased to announce the release of gitit 0.6.1.

Gitit is a wiki program that runs on happstack, the Haskell web
application server stack, and stores pages and other content in a
git or darcs filestore. The wiki can be updated either directly
through the VCS or through gitit's web interface. Pages can be written
in (extended) markdown, reStructuredText, HTML, or LaTeX, and exported
in ten different formats. TeX math is rendered using MathML by default,
and syntax highlighting is provided for over fifty languages.

demo:   http://gitit.johnmacfarlane.net
manual: http://gitit.johnmacfarlane.net/README
api:http://hackage.haskell.org/package/gitit-0.6.1
code:   http://github.com/jgm/gitit
bugs:   http://code.google.com/p/gitit/issues/list
group:  http://groups.google.com/group/gitit-discuss

Here is how you can install and run gitit. You'll need GHC and
cabal-install. If you don't have these, install the Haskell Platform
http://hackage.haskell.org/platform/. Then:

cabal update
cabal install gitit
mkdir mywiki
cd mywiki
gitit  # now browse to http://localhost:5001

Or, if you want to change the defaults (say, reStructuredText
instead of markdown, or darcs instead of git):

gitit --print-default-config  gitit.conf
# edit gitit.conf, which is self-documenting
gitit -f gitit.conf

The whole code base has been overhauled since the last release.
Gitit is now faster, more memory efficient, more modular, and more
secure. It also has many new features, including

  - page metadata and categories
  - atom feeds (sitewide and per-page)
  - support for literate Haskell
  - a better configuration system
  - an improved caching system
  - a Haskell library exporting happstack wiki handlers
  - a plugin system

The last two items are the most exciting and deserve special comment.

First, in addition to providing an executable, gitit now provides a
library, Network.Gitit, which makes it easy to include a gitit
wiki (or many of them) in any happstack application. It is
even possible to use the containing application's authentication
system for the wiki.

Second, gitit can now be extended through plugins, short Haskell
programs that are loaded dynamically when the server starts. For
examples of the things that can be done with plugins, see the
plugins directory, which contains (among other things) a plugin
for adding graphviz diagrams to pages and a plugin for adding
interwiki links.  For a full description of the plugin system,
see the haddock documentation for Network.Gitit.Interface.

Full changes from version 0.5.3, as well as upgrade instructions,
are available in the file CHANGES.

Thanks are due to

- the happstack team, for big improvements in happstack-server
  that make it much easier to work with,

- the darcs team, for using gitit/darcsit for http://wiki.darcs.net,
  giving gitit a real-world test,

- Gwern Branwen, who helped to optimize gitit, wrote the
  InterwikiPlugin, and wrote the guts of the Feed module,

- Simon Michael, who contributed several patches,

- Henry Laxen, who added support for password resets and helped with
  the apache proxy instructions,

- Anton van Straaten, who made the process of page generation
  more modular by adding Gitit.ContentTransformer,

- Robin Green, who helped improve the plugin API and interface,
  fixed a security problem with the reset password code, and made
  saving of the user's file more robust,

- Thomas Hartman, who helped improve the index page, making directory
  browsing persistent,

- Kohei Ozaki, who contributed the ImgTexPlugin,

- mightybyte, who suggested making gitit available as a library,
  and contributed a patch to the authentication system,

- and everyone else who contributed suggestions and bug reports.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: gitit 0.6.1

2009-08-25 Thread John MacFarlane
PS. I've put the library documentation here:
http://gitit.johnmacfarlane.net/doc/gitit/index.html

Does anyone understand why HackageDB is having trouble building
filestore 0.3.2?
http://hackage.haskell.org/packages/archive/filestore/0.3.2/logs/failure/ghc-6.10

John

+++ John MacFarlane [Aug 25 09 08:54 ]:
 I'm pleased to announce the release of gitit 0.6.1.
 
 Gitit is a wiki program that runs on happstack, the Haskell web
 application server stack, and stores pages and other content in a
 git or darcs filestore. The wiki can be updated either directly
 through the VCS or through gitit's web interface. Pages can be written
 in (extended) markdown, reStructuredText, HTML, or LaTeX, and exported
 in ten different formats. TeX math is rendered using MathML by default,
 and syntax highlighting is provided for over fifty languages.
 
 demo:   http://gitit.johnmacfarlane.net
 manual: http://gitit.johnmacfarlane.net/README
 api:http://hackage.haskell.org/package/gitit-0.6.1
 code:   http://github.com/jgm/gitit
 bugs:   http://code.google.com/p/gitit/issues/list
 group:  http://groups.google.com/group/gitit-discuss
 
 Here is how you can install and run gitit. You'll need GHC and
 cabal-install. If you don't have these, install the Haskell Platform
 http://hackage.haskell.org/platform/. Then:
 
 cabal update
 cabal install gitit
 mkdir mywiki
 cd mywiki
 gitit  # now browse to http://localhost:5001
 
 Or, if you want to change the defaults (say, reStructuredText
 instead of markdown, or darcs instead of git):
 
 gitit --print-default-config  gitit.conf
 # edit gitit.conf, which is self-documenting
 gitit -f gitit.conf
 
 The whole code base has been overhauled since the last release.
 Gitit is now faster, more memory efficient, more modular, and more
 secure. It also has many new features, including
 
   - page metadata and categories
   - atom feeds (sitewide and per-page)
   - support for literate Haskell
   - a better configuration system
   - an improved caching system
   - a Haskell library exporting happstack wiki handlers
   - a plugin system
 
 The last two items are the most exciting and deserve special comment.
 
 First, in addition to providing an executable, gitit now provides a
 library, Network.Gitit, which makes it easy to include a gitit
 wiki (or many of them) in any happstack application. It is
 even possible to use the containing application's authentication
 system for the wiki.
 
 Second, gitit can now be extended through plugins, short Haskell
 programs that are loaded dynamically when the server starts. For
 examples of the things that can be done with plugins, see the
 plugins directory, which contains (among other things) a plugin
 for adding graphviz diagrams to pages and a plugin for adding
 interwiki links.  For a full description of the plugin system,
 see the haddock documentation for Network.Gitit.Interface.
 
 Full changes from version 0.5.3, as well as upgrade instructions,
 are available in the file CHANGES.
 
 Thanks are due to
 
 - the happstack team, for big improvements in happstack-server
   that make it much easier to work with,
 
 - the darcs team, for using gitit/darcsit for http://wiki.darcs.net,
   giving gitit a real-world test,
 
 - Gwern Branwen, who helped to optimize gitit, wrote the
   InterwikiPlugin, and wrote the guts of the Feed module,
 
 - Simon Michael, who contributed several patches,
 
 - Henry Laxen, who added support for password resets and helped with
   the apache proxy instructions,
 
 - Anton van Straaten, who made the process of page generation
   more modular by adding Gitit.ContentTransformer,
 
 - Robin Green, who helped improve the plugin API and interface,
   fixed a security problem with the reset password code, and made
   saving of the user's file more robust,
 
 - Thomas Hartman, who helped improve the index page, making directory
   browsing persistent,
 
 - Kohei Ozaki, who contributed the ImgTexPlugin,
 
 - mightybyte, who suggested making gitit available as a library,
   and contributed a patch to the authentication system,
 
 - and everyone else who contributed suggestions and bug reports.
 
 ___
 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: Request for Changelogs

2009-08-09 Thread John MacFarlane
Agreed!  I put in a request for this about a year ago:
http://hackage.haskell.org/trac/hackage/ticket/299
There is a bit of follow-up discussion there.

John

+++ Joachim Breitner [Aug 06 09 16:27 ]:
 Hi,
 
 (this is mostly a rant, but hopefully a constructive one)
 
 the Haskell/cabal/hackage eco system is pretty great, as we all know.
 But there is one huge gaping omission there: Changelogs!
 
 I’m involved in packaging Haskell stuff for Debian. Now, the Debian
 tools we have for that tell me „Hlint has a new version, 1.6.5, which is
 newer than the one you packages, 1.6.4.
 
 Huh, nice. What has changed? Is it relevant for Debian? Is it worth a
 new upload? There is no easy way to find out:
 
 http://hackage.haskell.org/package/hlint lists no changes
 http://community.haskell.org/~ndm/hlint/ lists no changes
   (and not every package has a homepage)
 http://community.haskell.org/~ndm/darcs/hlint/ contains on Changes file
   (and not every package has a (linked) darcs repository)
 http://community.haskell.org/~ndm/darcs/hlint/ also has no web frontend.
 
 Which leaves me with the option of getting the darcs repo and looking
 through darcs changes. If I know of a repository for the package.
 
 So please, package authors, put Changes files in your packages and keep
 the current for now.
 
 And cabal/hackage guys: Llease introduce a standard Changes format for
 cabal packages so that http://hackage.haskell.org/package/hlint readily
 lists (or links to) changes.
 
 Thanks,
 Joachim
 
 -- 
 Joachim nomeata Breitner
 Debian Developer
   nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
   JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata



 ___
 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: Thinking about what's missing in our library coverage

2009-08-04 Thread John MacFarlane
+++ Don Stewart [Aug 03 09 22:53 ]:
 alexander.dunlap:
            o pandoc — markdown, reStructuredText, HTML, LaTeX, ConTeXt, 
   Docbook, OpenDocument, ODT, RTF, MediaWiki, groff
  
  No. Pandoc is too actively developed to go into the HP. It's also much
  more of an end-user application than a standard library - it's
  applications are not general enough to be included in the standard
  distribution.
  
 
 One comment on your thoughtful post.
 
 What role does having unique capabilities for the Haskell Platform play?
 
 Our base library is already notable for having OpenGL support out of the
 box. Maybe markup/markdown formats (for example) would also help Haskell
 stand out from the crowd. A similar case would be gtk2hs out of the box
 (Python supplied Tcl guis).
 
 On the other hand, maybe the HP should be aiming to be comprehensive
 enough to /support/ pandoc without additional dependencies.

I agree that pandoc shouldn't be in the HP.

Also, although we ought to have a zip encoding package, I'm not sure
it should be zip-archive (I'm the author).  zip-archive is not complete;
there are some kinds of zip files it can't parse.  Quoting the
documentation: there is no support for encryption, zip files that span
multiple disks, ZIP64, OS-specific file attributes, or compression
methods other than Deflate. A better solution, perhaps, would be a
binding to libzip.

In this connection, I want to make a general point about the HP:
In a way, it doesn't matter so much which additional pure Haskell
libraries it includes, because once you have cabal install, you can get
anything easily. For bindings to C libraries, it's another story.
pcre-light is a good example. If I want to tell someone how to install
pandoc with syntax highlighting, I can't just say, Get the HP and
then cabal install pandoc -fhighlighting. I have to say: First,
install the pcre library, if it's not already on your system... -- and
you lose a lot of users at this step.

Havig high-quality, high-level bindings to standard libraries like pcre,
libzip, etc., together with the C libraries themselves, in HP would be
very useful.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: yst 0.2.1

2009-08-03 Thread John MacFarlane
Thanks. I'll put a note to this effect in the README.

John

+++ Jinjing Wang [Aug 03 09 18:17 ]:
 It's possible to serve the generated site with maid, in case apache is
 not available:
 
 cabal update
 cabal install maid
 
 yst create testsite
 cd testsite
 yst
 
 cd site
 maid
 
 now goto http://localhost:3000/
 
 On Mon, Aug 3, 2009 at 9:05 AM, John MacFarlanej...@berkeley.edu wrote:
  I'm pleased to announce the release of yst, now available on HackageDB.
  yst generates static websites from YAML or CSV data files and
  StringTemplates. This approach combines the speed, security, and ease of
  deployment of a static website with the flexibility and maintainability
  of a dynamic site that separates presentation and data.
 
  The easiest way to get a feel for yst is to try it:
 
  cabal update
  cabal install yst
  yst create testsite
  cd testsite
  yst
 
  yst attempts to fill a niche between two kinds of site creation tools.
  On the one hand you have simple static site generators like webgen,
  webby, nanoc, and my old custom system using make and pandoc. On the
  other hand, you have dynamic web frameworks like rails and django.
  For my own smallish websites, I found that the dynamic frameworks were
  overkill. Nobody but me was going to edit the pages, and I didn't
  want the trouble of writing and deploying a dynamic site, setting up
  a web server, and administering a database. A static site would be
  faster, easier to deploy, and more secure. But the dynamic frameworks
  offered one thing that the static site generators did not: an easy way
  to separate data from presentation. This was becoming increasingly
  important to me as I found myself constantly updating the same
  information (say, publication data for a paper) in multiple places (say,
  a LaTeX CV and a differently formatted web listing of papers).
 
  What I wanted was a site generation tool that used YAML text files
  as a database and allowed different kinds of documents to be produced
  from the same data.  I couldn't find anything that did just what I
  wanted, so I wrote yst. By way of illustration, here are the build
  instructions for HTML and LaTeX versions of a CV, plus a web page with a
  list of papers:
 
  - url: cv.html
   title: CV
   template: cv.st
   data_common:  cvdata
     contact: from contact.yaml
     jobsbyemployer: from jobs.yaml order by start group by employer
     degrees: from degrees.yaml order by year desc
     awards: from awards.yaml order by year desc group by title
     papers: from papers.yaml order by year desc where (not (type = 'review'))
     reviews: from papers.yaml order by year desc where type = 'review'
     talks: from talks.yaml where date  '2009-09-01' order by date desc 
  group by title
     dissertations: from dissertations.yaml order by role then year group by 
  role
     theses: from theses.yaml order by year then student
     courses: from courses.yaml order by number group by title
   data:
     :  *cvdata
     html: yes
 
  - url: cv.tex
   title: CV
   inmenu: no
   template: cv.st
   layout: layout.tex.st
   data:
     :  *cvdata
     html: yes
 
  - url: papers.html
   title: Papers
   template: papers.st
   data:
     papersbyyear:  from papers.yaml order by year desc then title group by 
  year
 
  yst's query language is limited, and there are lots of things you can
  do with a full-fledged database that you can't do with yst. But yst
  is ideal, I think, for small to medium data-driven sites that are
  maintained by a single person who likes working with plain text. It
  scratched my itch, anyway, and I release it in case anyone else has the
  same itch.
 
  Code, documentation, and bug reports:  http://github.com/jgm/yst/tree/master
 
  John
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 -- 
 jinjing
 ___
 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: ANN: yst 0.2.1

2009-08-03 Thread John MacFarlane
+++ Michael Snoyman [Aug 03 09 22:20 ]:
Hey John,
 
I noticed that your code is using the Syck library for Yaml. How were you
able to get it to deal with Unicode characters? I just wrote a new yaml
library based on libyaml if you want to give it a shot (yaml on hackage).
It doesn't support aliases, but is otherwise feature complete.
 
Michael

Oh, rats, I hadn't realized that Syck had that limitation!  I think I
can work around it, but I'll have to look into it.

I wasn't able to install your yaml library:

% cabal install yaml
Resolving dependencies...
Configuring yaml-0.0.0...
Preprocessing library yaml-0.0.0...
dist/build/Text/Libyaml.chs.h:2:31: error: ../../../c/helper.h: No such file or 
directory
c2hs: Error during preprocessing custom header file
cabal: Error: some packages failed to install:
yaml-0.0.0 failed during the building phase. The exception was:
exit: ExitFailure 1

I have debian libyaml-dev installed.  Any ideas?

Also, how hard would it be to support aliases in your package?  I use them.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: yst 0.2.1

2009-08-03 Thread John MacFarlane
+++ John MacFarlane [Aug 03 09 13:23 ]:
 +++ Michael Snoyman [Aug 03 09 22:20 ]:
 Hey John,
  
 I noticed that your code is using the Syck library for Yaml. How were you
 able to get it to deal with Unicode characters? I just wrote a new yaml
 library based on libyaml if you want to give it a shot (yaml on hackage).
 It doesn't support aliases, but is otherwise feature complete.
  
 Michael
 
 Oh, rats, I hadn't realized that Syck had that limitation!  I think I
 can work around it, but I'll have to look into it.

Okay, I've found a workaround -- use Syck to parse a bytestring, then do my
own decoding on string buffers in the resulting parse tree. Unicode in
data files now works well.  (Code now on github -- will be released soon.)

John 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: yst 0.2.1

2009-08-02 Thread John MacFarlane
I'm pleased to announce the release of yst, now available on HackageDB.
yst generates static websites from YAML or CSV data files and
StringTemplates. This approach combines the speed, security, and ease of
deployment of a static website with the flexibility and maintainability
of a dynamic site that separates presentation and data.

The easiest way to get a feel for yst is to try it:

cabal update
cabal install yst
yst create testsite
cd testsite
yst

yst attempts to fill a niche between two kinds of site creation tools.
On the one hand you have simple static site generators like webgen,
webby, nanoc, and my old custom system using make and pandoc. On the
other hand, you have dynamic web frameworks like rails and django.
For my own smallish websites, I found that the dynamic frameworks were
overkill. Nobody but me was going to edit the pages, and I didn't
want the trouble of writing and deploying a dynamic site, setting up
a web server, and administering a database. A static site would be
faster, easier to deploy, and more secure. But the dynamic frameworks
offered one thing that the static site generators did not: an easy way
to separate data from presentation. This was becoming increasingly
important to me as I found myself constantly updating the same
information (say, publication data for a paper) in multiple places (say,
a LaTeX CV and a differently formatted web listing of papers).

What I wanted was a site generation tool that used YAML text files
as a database and allowed different kinds of documents to be produced
from the same data.  I couldn't find anything that did just what I
wanted, so I wrote yst. By way of illustration, here are the build
instructions for HTML and LaTeX versions of a CV, plus a web page with a
list of papers:

- url: cv.html
  title: CV
  template: cv.st
  data_common:  cvdata
contact: from contact.yaml
jobsbyemployer: from jobs.yaml order by start group by employer
degrees: from degrees.yaml order by year desc
awards: from awards.yaml order by year desc group by title
papers: from papers.yaml order by year desc where (not (type = 'review'))
reviews: from papers.yaml order by year desc where type = 'review'
talks: from talks.yaml where date  '2009-09-01' order by date desc group 
by title
dissertations: from dissertations.yaml order by role then year group by role
theses: from theses.yaml order by year then student
courses: from courses.yaml order by number group by title
  data:
:  *cvdata
html: yes

- url: cv.tex
  title: CV
  inmenu: no
  template: cv.st
  layout: layout.tex.st
  data:
:  *cvdata
html: yes

- url: papers.html
  title: Papers
  template: papers.st
  data:
papersbyyear:  from papers.yaml order by year desc then title group by year

yst's query language is limited, and there are lots of things you can
do with a full-fledged database that you can't do with yst. But yst
is ideal, I think, for small to medium data-driven sites that are
maintained by a single person who likes working with plain text. It
scratched my itch, anyway, and I release it in case anyone else has the
same itch.

Code, documentation, and bug reports:  http://github.com/jgm/yst/tree/master

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Example for formatted show in HStringTemplate

2009-07-14 Thread John MacFarlane
+++ Kemps-Benedix Torsten [Jul 13 09 23:56 ]:
 Hello,
 
 is there a working example of how to use the format clause with 
 HStringTemplate, e.g. for Data.Time.Day? I think, if there is a parameter 
 $day$, a reasonable template might contain e.g.:
 
 $day;format=%d.%b.%Y$
 
 But I only get toModifiedJulianDay: [54960] as the result which corresponds 
 to the unformatted show.

You probably need to define a StringTemplateShows instance for
Data.Time.Day, and then use stShowsToSE to define a ToSElem instance.
Something like

instance StringTemplateShows Day
  where stringTemplateFormattedShow formatString = formatTime defaultTimeLocale 
formatString 
   {- or whatever -- I'm not sure what the correct time-formatting function is 
-}

instance ToSElem Day
  where toSElem = stShowsToSE

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: AW: Example for formatted show in HStringTemplate

2009-07-14 Thread John MacFarlane
Torsten,

I'm not quite sure what you're asking -- but this simple example seems
to work fine:

Prelude Text.StringTemplate let (a :: StringTemplate String) = newSTMP 
$day;format=\%d.%b.%Y\$
Prelude Text.StringTemplate Data.Time render $ setAttribute day 
(ModifiedJulianDay 234) a
09.Jul.1859

John

+++ Kemps-Benedix Torsten [Jul 14 09 12:20 ]:
 John,
 
 thanks for your answer, but HStringtemplate has instance definitions for 
 Date.Time.Day. The question is more on the script side: How do I have to 
 write the ST calls with ;format= embedded in HTML?
 
 regards,
 
 Torsten 
 
 
 
 -Ursprüngliche Nachricht-
 Von: John MacFarlane [mailto:fiddlosop...@gmail.com] 
 Gesendet: Dienstag, 14. Juli 2009 08:20
 An: Kemps-Benedix Torsten
 Cc: ha...@googlegroups.com; haskell-cafe@haskell.org
 Betreff: Re: Example for formatted show in HStringTemplate
 
 +++ Kemps-Benedix Torsten [Jul 13 09 23:56 ]:
  Hello,
  
  is there a working example of how to use the format clause with 
  HStringTemplate, e.g. for Data.Time.Day? I think, if there is a parameter 
  $day$, a reasonable template might contain e.g.:
  
  $day;format=%d.%b.%Y$
  
  But I only get toModifiedJulianDay: [54960] as the result which 
  corresponds to the unformatted show.
 
 You probably need to define a StringTemplateShows instance for
 Data.Time.Day, and then use stShowsToSE to define a ToSElem instance.
 Something like
 
 instance StringTemplateShows Day
   where stringTemplateFormattedShow formatString = formatTime 
 defaultTimeLocale formatString 
{- or whatever -- I'm not sure what the correct time-formatting function 
 is -}
 
 instance ToSElem Day
   where toSElem = stShowsToSE
 
 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] ANN: texmath 0.1.0.1 - conversion of LaTeX math to MathML

2009-07-08 Thread John MacFarlane
I'm pleased to announce an early release of texmath, a Haskell library
for converting LaTeX math formulas to MathML.

Hackage: http://hackage.haskell.org/package/texmath-0.1.0.1
Github: http://github.com/jgm/texmath/tree/master

The package includes a standalone test program, testTeXMathML,
and a CGI script, texmath-cgi, that can be used in web apps. This
script is used in the demos at

http://johnmacfarlane.net/texmath.xhtml
http://johnmacfarlane.net/texmath.html

texmath supports most of basic LaTeX and AMS extensions, but I'm sure
some things have been left out, so let me know if you try a formula that
should work but doesn't.

John
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] ANN: texmath 0.1.0.1 - conversion of LaTeX math to MathML

2009-07-08 Thread John MacFarlane
I'm pleased to announce an early release of texmath, a Haskell library
for converting LaTeX math formulas to MathML.

Hackage: http://hackage.haskell.org/package/texmath-0.1.0.1
Github: http://github.com/jgm/texmath/tree/master

The package includes a standalone test program, testTeXMathML,
and a CGI script, texmath-cgi, that can be used in web apps. This
script is used in the demos at

http://johnmacfarlane.net/texmath.xhtml
http://johnmacfarlane.net/texmath.html

texmath supports most of basic LaTeX and AMS extensions, but I'm sure
some things have been left out, so let me know if you try a formula that
should work but doesn't.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell] ANN: pandoc 1.2

2009-03-01 Thread John MacFarlane
I'm pleased to announce the release of pandoc version 1.2
(uploaded today to HackageDB).

The most significant new feature is support for literate Haskell.
You can now use pandoc directly on literate Haskell source files
to produce syntax-highlighted HTML output:

pandoc -s MyProg.lhs  MyProg.html

Pandoc will interpret text sections as (extended) markdown.  If
you prefer to write literate Haskell using reStructuredText
or LaTeX, pandoc supports that too:

pandoc -s --from rst+lhs MyProg.lhs  MyProg.html
pandoc -s --from latex+lhs MyProg.lhs  MyProg.html

You can even convert from one style to another:

pandoc -s --from markdown+lhs --to latex+lhs MyProg.hs

This release also adds an '--email-obfuscation' option, so
the user can select an email obfuscation method (or disable
obfuscation), and support for citations using the latest version
of Andrea Rossato's citeproc-hs.

In addition, many bugs have been fixed.  Thanks to everyone
who filed bug reports.

John

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] ANN: gitit 0.5.1

2009-02-01 Thread John MacFarlane
I've just uploaded gitit 0.5.1 to HackageDb. Gitit is a wiki program
that uses git or darcs as a filestore and HAppS as a server.

Changes:

* Major code reorganization, making gitit more modular.
* Gitit can now optionally be built using Happstack instead of HAppS
  (just use -fhappstack when cabal installing).
* Fixed bug with directories that had the same names as pages.
* Added code from HAppS-Extra to fix cookie parsing problems.
* New command-line options for --port, --debug.
* New debug feature prints the date, the raw request, and
  the processed request data to standard output on each request.
* Files with .page extension can no longer be uploaded.
* Apostrophes and quotation marks now allowed in page names.

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] ANN: gitit 0.5.1

2009-02-01 Thread John MacFarlane
I've just uploaded gitit 0.5.1 to HackageDb. Gitit is a wiki program
that uses git or darcs as a filestore and HAppS as a server.

Changes:

* Major code reorganization, making gitit more modular.
* Gitit can now optionally be built using Happstack instead of HAppS
  (just use -fhappstack when cabal installing).
* Fixed bug with directories that had the same names as pages.
* Added code from HAppS-Extra to fix cookie parsing problems.
* New command-line options for --port, --debug.
* New debug feature prints the date, the raw request, and
  the processed request data to standard output on each request.
* Files with .page extension can no longer be uploaded.
* Apostrophes and quotation marks now allowed in page names.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: diagrams 0.2

2009-01-31 Thread John MacFarlane
+++ Braden Shepherdson [Jan 31 09 18:23 ]:
 Brent Yorgey wrote:
 I am very pleased to announce the 0.2 release of the diagrams package,
 an embedded domain-specific language for creating simple graphics in a
 compositional style.  This release includes a number of significant
 new features, including:

   * support for arbitrary straight and curved paths
   * more shape primitives, including polygons and rounded rectangles
   * support for rendering text
   * PNG, PDF, PS, and SVG output
   * built-in color support replaced with external dependence on the 
 feature-rich colour library

 and many more!  More information, examples, and installation
 instructions can be found at http://code.haskell.org/diagrams.  More
 features are planned for future releases, so contributions and
 suggestions are welcome.

 (Please note: since diagrams depends on the Cairo library, which has
 unfortunately not been Cabalized, you cannot install the diagrams
 library with cabal-install, unless you already have the cairo package
 installed. See the above website for instructions.)

 A special thanks to Dougal Stanton for his contributions to the
 library and help in preparing this release.

 -Brent

 Would this make a handy plugin for gitit? I'm currently putting diagrams  
 together in xfig and saving them to my gitit tree while taking notes in  
 gitit, but being able to write diagrams code into gitit would be great.

 How easy or hard would this be to accomplish?

Not too hard, I think.  Here's code for something similar (for graphviz
diagrams), derived from plugins/DotPlugin.hs in SVN pandoc.

transform :: Block - IO Block
transform (CodeBlock (id, classes, namevals) contents) | dot `elem` 
classes = do
  let (name, outfile) =  case lookup name namevals of
Just fn   - ([Str fn], fn ++ .png)
Nothing   - ([], uniqueName contents ++ 
.png)
  result - readProcess dot [-Tpng] contents
  writeFile outfile result
  return $ Para [Image name (outfile, )]
transform x = return x

-- | Generate a unique filename given the file's contents.
uniqueName :: String - String
uniqueName = showDigest . sha1 . fromString

The 'transform' function will transform delimited code blocks such
as

~~~ {.dot name=diagram1}
digraph G {Hello-World}
~~~

into images generated by running the contents through graphviz's dot. To
lift this into a transformation of Pandoc documents, you can use syb:

convertGraphviz :: Pandoc - IO Pandoc
convertGraphviz = everywhereM (mkM transform)

With minimal modifications, the same technique should work for
diagrams...

Best,
John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: gitit 0.5

2009-01-24 Thread John MacFarlane
We are pleased to announce the latest release of Gitit, the
multitalented distributed wiki written in Haskell.

What's new in this release?

* 'Gitit' is now something of a misnomer, as Gitit now makes use of
  the filestore library. The upshot is that Gitit can now work in Darcs
  repositories; if before you thought Gitit was cool but didn't like
  git, you now have no excuse!

* Gitit has been optimized (thanks to the efforts of Gwern Branwen):
  - Pages are now gzipped whenever possible.
  - Expire headers are set so that CSS, images, and javascripts
will be cached by the browser.
  - Those previously mentioned elements have been optimized for space,
and rearranged in the generated pages for faster rendering.

* A new configuration option allows reStructuredText to be used instead
  of markdown (thanks to a patch from Simon Michael).

* Gitit now sports a 'Go' box. You can now either search through
  Search, or go to a specific page title via Go.

* Search is smarter, and can also return page titles.

* Revisions are better formatted: the author field now include the
  user's email as well.

* Diffs are of much higher quality, thanks to filestore.

* UTF8-related fixes.

You can check out a running example at http://gitit.johnmacfarlane.net/.

Or try it locally:

  cabal update
  cabal install -fhighlighting pandoc gitit
  gitit  # note: this will create two subdirectories in the working directory
 # then browse to http://localhost:5001.

The git repository for Gitit is at http://github.com/jgm/gitit/tree/master

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: gitit-0.4.1, recaptcha-0.1

2008-12-31 Thread John MacFarlane
I'm pleased to announce the release of gitit-0.4.1, which I've just
uploaded to HackageDB.  Gitit is a wiki program that stores pages in
a git repostory.

Gitit now has support for (optional) captchas, using the reCAPTCHA
service. I've packaged up the reCAPTCHA code as a separate library on
HackageDB, recaptcha.

Upgrading from older versions of gitit:

The format of gitit's user database has changed. (gitit now generates a
new random salt for each user, instead of using a single static salt for
all users.) Unfortunately, this means that current users of gitit (yes,
all seven of you) will have to delete your gitit-users file and have
your users create new accounts.  Sorry about the breaking change, but
better now than later.

When you upgrade, you'll also need to delete the _local directory,
since changes have been made to the data structure that holds the
application state.  This shouldn't have any ill effects, since
everything of lasting importance (users, pages) is stored elsewhere.

If you use a configuration file, or if you want to start using reCAPTCHA
(which requires a configuration file), you will also have to add fields
for the captcha system. See data/SampleConfig.hs for the format.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Gitit - Encoding

2008-12-30 Thread John MacFarlane
Arnaud,

You just need to make sure that the raw page files (stored in git) use
UTF-8.  Then accented characters should appear correctly.
Sample: http://johnmacfarlane.net:5001/Multilingual
(The UTF-8 requirement should be documented...I'll make a note
of it.)

John

+++ Arnaud Bailly [Dec 30 08 13:58 ]:
 Hello,
 I have started using Gitit and I am very happy with it and eager to
 start hacking. I am running into a practical problem: characters
 encoding. When I edit pages using accented characters (I am french),
 the accents get mangled when the page come back from server.
 
 The raw files are incorrectly encoded. Where Shall I look for fixing
 this issue ?
 
 Thanks
 
 ps: the wiki is live at http://www.notre-ecole.org
 
 -- 
 Arnaud Bailly, PhD
 OQube - Software Engineering
 
 web http://www.oqube.com
 ___
 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: Gitit - Encoding

2008-12-30 Thread John MacFarlane
Jeremy,

Thanks, this is useful.  Gitit already uses UTF-8 where it should,
I think, but I hadn't noticed the issue with look* functions
and ToMessage instances in HAppS.  This affects gitit too
(try typing an accented string into the search box, for example).

I strongly agree that HAppS should be fixed, but until that
happens I'll look into putting workarounds into gitit.

John


 For example, lookPairs currently looks like this:
 
  lookPairs :: RqData [(String,String)]
  lookPairs = asks fst = return . map (\(n,vbs)-(n,L.unpack $ inputValue 
  vbs))
 
 As you can see, it just takes the incoming bytes and converts them to
 a String, but without doing any decoding. You probably want something
 more like:
 
  lookPairs :: RqData [(String,String)]
  lookPairs = asks fst = return . map 
  (\(n,vbs)-(n,Data.ByteString.Lazy.UTF8.toString $ inputValue vbs))
 
 Some of the other look* functions need patching as well.
 
 Similarily, the ToMessage instances need to encode the outgoing data. 
 Consider:
 
  instance ToMessage Html where
 toContentType _ = B.pack text/html
 toMessage = L.pack . renderHtml
 
 We really want to make two changes:
 
  instance ToMessage Html where
 toContentType _ = B.pack text/html; charset=UTF-8-- add 
  the encoding
 toMessage = Data.ByteString.Lazy.UTF8.fromString . renderHtml  -- encode 
  the data
 
 3. make sure that any I/O (readFile, writeFile, etc) uses the utf-8
 functions from utf8-string.
 
 If you don't want to patch HAppS-Server, then you could work around it by 
 doing silliness like:
 
  do pairs' - lookPairs
 let pairs = map (first toString . second toString) pairs'
 
 
 hope this helps.
 - jeremy
 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Gitit - Encoding

2008-12-30 Thread John MacFarlane
 I switched template.html to advertising encoding of iso-8859-1 and
 things are working ok. I setup LANG (and LC_ALL) to fr_FR.UTF-8. When
 I set meta tag with utf-8 encoding, things get messy.
 
 John: I checked your url and, oddly enough, characteres appears OK
 when I manually change page display encoding to latin-1. I came to the
 possibly obvious conclusion that:
  -gitit communicated with HApps hence the outside world in latin-1
  - talk to git in utf-8
 
 Is this the right picture ?

No -- if this works, it's by accident! After your initial query, I
discovered that gitit did not in fact support UTF-8 properly. I have now
fixed all the problems I'm aware of and released version 0.3.4.1. (When
you try this, use utf-8 again in the meta tag in your template.)

The new version even allows multilingual page names -- anything your
file system will allow as a filename should work. There's a
demonstration at http://johnmacfarlane.net:5001/Multilingual.

 BTW, my accents problem solved, I would like to work with RSS feeds so that:
  1. a user could put a feed inside a page
  2. gitit could produce feeds for changes/adds
 I have done things like that before in Java but would need some
 directions to incorporate it in gitit.

Check out the rss package in Hackage:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/rss

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell] possible bug in pretty-1.0.1.0

2008-12-15 Thread John MacFarlane
I noticed a difference in how hang works between pretty-1.0.0.0 and
pretty-1.0.1.0. I think it's a bug. If this isn't the right place to
report it, please let me know where I should.  (Maintainer is listed
as librar...@haskell.org, but that is a closed mailing list.  Perhaps
Cabal should include a report-bugs-at field?)

John

GHCi, version 6.8.3: http://www.haskell.org/ghc/  :? for help
...
Prelude Text.PrettyPrint  putStrLn $ render $ hang (char '*') 4 (text hi $$ 
text there)
Loading package pretty-1.0.0.0 ... linking ... done.
*   hi
there

GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
...
Prelude Text.PrettyPrint  putStrLn $ render $ hang (char '*') 4 (text hi $$ 
text there)
Loading package pretty-1.0.1.0 ... linking ... done.
*
hi
there

___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread John MacFarlane
+++ Hugo Pacheco [Dec 03 08 09:36 ]:
Good morning,
I wonder if it is possible to embed regular HTML code inside gitit (on
0.3.2) pages, such as java applets like the following.
APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100 HEIGHT =
400 ALT = you should see an instance of GHood here, as an applet PARAM
NAME = eventSource VALUE =factHylo.log PARAM NAME = delay VALUE
=150 PARAM NAME = scale VALUE =75 /APPLET
I am assuming that as a wiki, it is only possible to point to external
pages.
Thanks,
hugo

Of course you can put any HTML you like in the page template
(template.html).  But I assume you are asking about HTML inside the wiki
pages themselves. Although markdown allows embedded HTML, gitit uses pandoc's
HTML sanitization feature, so things that might be dangerous (like
applets) will be filtered out and replaced by comments.

You could easily modify the code to remove the santitization feature.
Just change the textToPandoc function so that stateSanitizeHtml is set to
False.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread John MacFarlane
+++ Anatoly Yakovenko [Dec 03 08 17:03 ]:
 This is pretty cool.  I was wondering how much work would it be for
 gitit to be able to use markdown from the comment sections in source
 files?  It would be a really good way to manage documentation.
 
 Basically I would like to be able to point gitit at an existing git
 repo, and have it provide a wiki interface to all the documentation so
 developers can view and modify it.

You can do something like that now. You can specify the repository
directory in a configuration file. Anything in the repository (even
in subdirectories) with a .page extension will be served up as a
wiki page. So you'd have to use a .page extension for your markdown
documentation. Everything else in the repository will appear in the
index. Source code files will be automatically syntax-highlighted, and
you can even view history and diffs through the wiki interface.

But I guess what you want is for the documentation to be in comments
in the source files themselves, not in separate files.  I'm not sure
how to do that -- would the idea be to show just the documentation,
perhaps marked off with some special notation, and not the source?
But then we lose a nice feature, the ability to view source files.
I'm open to ideas.

Soon, gitit will contain support for pages in markdownish literate
Haskell, which might be the best of both worlds for Haskell projects.
(They'd still need the .page extension, since some .lhs files are
LaTeX lhs, but one could use hard links, or there could be a
configuration option to treat .lhs files as wiki pages.)

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: '#' in literate haskell

2008-12-01 Thread John MacFarlane
+++ Bertram Felgenhauer [Nov 30 08 09:57 ]:
 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 `'

Thanks!  Mystery solved.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] '#' in literate haskell

2008-11-29 Thread John MacFarlane
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] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-11-09 Thread John MacFarlane
I've just uploaded a new version (0.2.1) that requires HAppS = 0.9.3 
 0.9.4. (There are small API changes from 0.9.2 to 0.9.3, so I thought
it best not to allow 0.9.2.x, even though it still compiles with a
warning.)

+++ Hugo Pacheco [Nov 09 08 20:41 ]:
a new HAppS version [1]0.9.3.1 has been released, and gitit requires
HApps==[2]0.9.2.1. should ti be ok just to relax the dependency?
 
On Sat, Nov 8, 2008 at 8:32 PM, John MacFarlane [EMAIL PROTECTED]
wrote:
 
  I've uploaded an early version of gitit, a Haskell wiki program, to
  HackageDB. Gitit uses HAppS as a webserver, git for file storage,
  pandoc for rendering the (markdown) pages, and highlighting-kate for
  highlighted source code.
 
  Some nice features of gitit:
 
   - Pages and uploaded files are stored in a git repository and may
 be added, deleted, and modified directly using git.
   - Pages may be organized into subdirectories.
   - Pandoc's extended version of markdown is used, so you can do tables,
 footnotes, syntax-highlighted code blocks, and LaTeX math. (And
 you can you pandoc to convert pages into many other formats.)
   - Math is rendered using jsMath (which must be installed
 separately).
   - Source code files in the repository are automatically rendered with
 syntax highlighting (plain/text version is also available).
 
  You can check it out on my webserver: [4]http://johnmacfarlane.net:5001/
  Or try it locally:
 
 cabal update
 cabal install pandoc -fhighlighting
 cabal install gitit
 gitit  # note: this will create two subdirectories in the working
  directory
 # then browse to [5]http://localhost:5001.
 
  There's a git repository at [6]http://github.com/jgm/gitit/tree/master.
  Comments and patches are welcome.
 
  John
  ___
  Haskell-Cafe mailing list
  [EMAIL PROTECTED]
  [8]http://www.haskell.org/mailman/listinfo/haskell-cafe
 
--
[9]www.di.uminho.pt/~hpacheco
 
 References
 
Visible links
1. http://0.9.3.1/
2. http://0.9.2.1/
3. mailto:[EMAIL PROTECTED]
4. http://johnmacfarlane.net:5001/
5. http://localhost:5001/
6. http://github.com/jgm/gitit/tree/master
7. mailto:Haskell-Cafe@haskell.org
8. http://www.haskell.org/mailman/listinfo/haskell-cafe
9. http://www.di.uminho.pt/~hpacheco

 ___
 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] ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-11-08 Thread John MacFarlane
I've uploaded an early version of gitit, a Haskell wiki program, to
HackageDB. Gitit uses HAppS as a webserver, git for file storage,
pandoc for rendering the (markdown) pages, and highlighting-kate for
highlighted source code.

Some nice features of gitit:

  - Pages and uploaded files are stored in a git repository and may
be added, deleted, and modified directly using git.
  - Pages may be organized into subdirectories.
  - Pandoc's extended version of markdown is used, so you can do tables,
footnotes, syntax-highlighted code blocks, and LaTeX math. (And
you can you pandoc to convert pages into many other formats.)
  - Math is rendered using jsMath (which must be installed
separately).
  - Source code files in the repository are automatically rendered with
syntax highlighting (plain/text version is also available).

You can check it out on my webserver: http://johnmacfarlane.net:5001/ 
Or try it locally:

cabal update
cabal install pandoc -fhighlighting
cabal install gitit
gitit  # note: this will create two subdirectories in the working directory
# then browse to http://localhost:5001.

There's a git repository at http://github.com/jgm/gitit/tree/master.
Comments and patches are welcome.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Pandoc questions

2008-10-17 Thread John MacFarlane
 1. Nobody has written the LaTeX - MathML code yet, and I've been too
 lazy.  Anyone who is interested in doing this should get in touch.
   

 Well, I'd certainly be interested. I use mathematics *a lot* in my  
 writing. Presumably modifying a large program like Pandoc is intractably  
 difficult though?

Just write a separate library that parses LaTeX input and returns MathML
output. Pandoc could then use this library. So you wouldn't need to know
anything about pandoc's internals. Just write a function 

teXMathToMathML :: String - String. 

This would be a great contribution!  You could get a head start by
looking at the LaTeXMathML.js code.

 It strikes me that perhaps using LaTeX to enter mathematical markup is  
 rather against the spirit of Markdown. Surely there should be an option  
 to include raw LaTeX, but a more natural encoding that covers most  
 mathematics would be nice also. Of course, that means somebody has to  
 design it first...

I think it makes good sense to use LaTeX, which is already designed to
be natural but flexible, and is already known by most mathematicians.
My guess is that in designing a more natural format, one would
eventually reinvent something like LaTeX...

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Pandoc questions

2008-10-16 Thread John MacFarlane
+++ Andrew Coppin [Oct 12 08 11:21 ]:
 There doesn't seem to be any option to make Pandoc produce actual MathML  
 output. Is there a reason for this?

1. Nobody has written the LaTeX - MathML code yet, and I've been too
lazy.  Anyone who is interested in doing this should get in touch.

2. Not all browsers can process MathML. The current system (using the
LaTeXMathML.js javascript) has the advantage of falling back to raw
LaTeX in browsers that don't support MathML.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Bird-style and blank lines

2008-09-21 Thread John MacFarlane
 3. Pandoc, via markdown, is a very interesting alternative to latex.
 Right now you can write a block of code like this:
 
 ~~~
  fact :: Integer - Integer
  fact 0 = 1
  fact n = n * fact (n-1)
 ~~~
 
 except that that won't work, precisely because you must have a blank
 line before and after the code.  Unfortunately, when you go and add
 the blank lines, the output will show them.

Note: I've changed pandoc in the repository so that it no longer
shows these blank lines. The next point release will incorporate this
change, making it easier to use pandoc for literate haskell. Note also
that if you begin the code block with

~~~ {.haskell}

the HTML output will be syntax-highlighted (assuming you compiled
pandoc with the -fhighlighting flag).

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Mac OS X dylib woes

2008-09-17 Thread John MacFarlane
 If you type ghc-pkg describe pcre-light, does it list
 /opt/local/lib under the library-dirs: field?  If not, that's most
 likely your problem.  Try unregistering the library and reinstalling
 with:
 
 cabal install pcre-light --extra-include-dirs=/opt/local/include
 --extra-lib-dirs=/opt/local/lib

That worked!  Thanks.
John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Mac OS X dylib woes

2008-09-16 Thread John MacFarlane
I'm hoping some Haskell developers who use Macs can help me with this
one. I can install pcre-light just fine using cabal install. But when I
try to use it, I get this error:

GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
:Loading package base ... linking ... done.
Prelude :m Text.Regex.PCRE.Light.Char8
Prelude Text.Regex.PCRE.Light.Char8 compile h. []
Loading package array-0.1.0.0 ... linking ... done.
Loading package bytestring-0.9.0.1 ... linking ... done.
Loading package pcre-light-0.3.1 ... can't load .so/.DLL for: pcre 
(dlopen(libpcre.dylib, 10): image not found)

OK, so it can't find the pcre library (which is in /opt/local/lib).
I can fix that:

export DYLD_LIBRARY_PATH=/opt/local/lib

Now it works. But other things are broken! For example, I can't run vim,
which looks for a library called libJPEG.dylib and now finds libjpeg.dylib
in /opt/local/lib (case-insensitive file system!).

The apple website recommends against setting DYLD_LIBRARY_PATH.
Instead, they say, the paths to the libraries should be hard-coded into
the binary:
http://discussions.apple.com/thread.jspa?threadID=1670523tstart=0

I'm sure others have had the same problem.  What's the solution?

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Hackage - MacPorts?

2008-09-03 Thread John MacFarlane
It would be great if there were an automated or semi-automated way
of generating a MacPorts Portfile from a HackageDB package, along
the lines of dons' cabal2arch. Has anyone been working on such a thing?
And, are any haskell-cafe readers MacPorts committers?

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANN: zip-archive 0.1

2008-09-02 Thread John MacFarlane
Thanks again for the feedback! I've modified the zip-archive library
along the lines you suggested. Version 0.1 is now available on
HackageDB.

John

+++ Duncan Coutts [Aug 26 08 21:36 ]:
 
 Generally it looks good, that the operations on the archive are mostly
 separated from IO of writing out archives or creating entries from disk
 files etc.
 
 Looking at the API there feels to be slightly too much exposed. Eg does
 the MSDOSDateTime need to be exposed, or the (de)compressData functions.
 
 My personal inclination is to leave off the Zip prefix in the names and
 use qualified imports. I'd also leave out trivial compositions like
 
 readZipArchive  f = toZipArchive $ B.readFile f
 writeZipArchive f = B.writeFile f . fromZipArchive
 
 but reasonable people disagree.
 
 For both the pack in my tar lib and your addFilesToZipArchive, there's a
 getDirectoryContentsRecursive function asking to get out. This function
 seems to come up often. Ideally pack/unpack and
 addFilesToZipArchive/extractFilesFromZipArchive would just be mapM_
 extract or create for an individual entry over the contents of the
 archive or the result of a recursive traversal.
 
 So yeah, I feel these operations ought to be simpler compositions of
 other things, in your lib and mine, since this bit is often the part
 where different use cases need slight variations, eg in how they write
 files, or deal with os-specific permissions/security stuff. So if these
 are compositions of simpler stuff it should be easier to add in extra
 stuff or replace bits.
 
 Duncan
 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: zip-archive 0.0

2008-08-26 Thread John MacFarlane
I've written a library, zip-archive, for dealing with zip archives.

Haddock documentation (with links to source code):
http://johnmacfarlane.net/zip-archive/ 

Darcs repository:
http://johnmacfarlane.net/repos/zip-archive/

It comes with an example program that duplicates some of the
functionality of 'zip' (configure with '-fexecutable' to build it).

I intend to put it on HackageDB, but I thought I'd get some feedback
first. Bug reports, patches, and suggestions on the API are all welcome.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Brainstorming on how to parse IMAP

2008-08-05 Thread John MacFarlane
+++ John Goerzen [Aug 05 08 10:13 ]:
  I'm interested in thoughts people have on parsing libraries and methods.
   I'm a huge fan of Parsec overall -- it lets me have a single-stage
  parser, for instance.  But it isn't sufficiently lazy for this task, and
  I probably will need to deal with ByteStrings instead of Strings, since
  some IMAP messages may be 30MB or more.
  
  You might be interested in Frisby: http://repetae.net/computer/frisby/
 
 Are there any examples available for it anywhere?

I wrote a markdown parser using Frisby:
http://github.com/jgm/markdown-peg/tree/master

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] library for zip compression?

2008-07-27 Thread John MacFarlane
Haskellers,

Is there a library for compressing and uncompressing zip archives? I see
zlib and bzlib on HackageDB, but unless I'm mistaken these won't help
with a .zip archive. (See http://zlib.net/zlib_faq.html#faq11.) Any help
here would be appreciated.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: highlighting-kate-0.2

2008-02-10 Thread John MacFarlane
I've just uploaded highlighting-kate-0.2 to HackageDB. highlighting-kate
is a source code syntax highlighting library, based on syntax
description files from the Kate editor (http://kate-editor.org/).

Currently, the following languages are supported:

AdaAlert Asp Awk Bash   
Bibtex C Cmake   Coldfusion  Commonlisp 
CppCss   D   Djangotemplate  Doxygen
DtdEiffelErlang  Fortran Haskell
Html   Java  Javadoc Javascript  Json   
Latex  Lex   LiterateHaskell Lua Makefile   
Matlab Mediawiki Modula3 NasmObjectivec 
Ocaml  PascalPerlPhp Postscript 
Prolog PythonRhtml   RubyScala  
Scheme Sgml  Sql SqlMysqlSqlPostgresql  
TclTexinfo   Xml XsltYacc   

The tarball includes a utility for generating new syntax highlighting
modules from XML syntax descriptions.  It also includes the source code
for a command-line syntax highlighting program, Highlight.

Please send bug reports and suggestions my way.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: highlighting-kate - syntax highlighting library

2008-02-03 Thread John MacFarlane
 Not to me. Where is Eiffel?

I've just added it.  The library is so big already that I left out a
bunch of languages for which there are Kate syntax definitions.  But I'm
happy to add them on request.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] highlighting-kate - syntax highlighting library

2008-02-02 Thread John MacFarlane
Hello all,

I've been working on a source code syntax highlighting library. It is
now somewhat usable, and help would be welcome in testing it further, so
I'm making it publicly available:

darcs get http://johnmacfarlane.net/repos/highlighting-kate

Currently, the following languages are supported:

AdaAsp  AwkBash Bibtex
C  CmakeColdfusion Commonlisp   Cpp
CssDDiff   Djangotemplate   Doxygen
DtdErlang   FortranHaskell  Html
Java   Javadoc  Javascript Json Latex
LexLiterateHaskell  LuaMakefile Matlab
Mediawiki  Nasm Objectivec Objectivecpp Ocaml
Pascal Perl PhpPostscript   Prolog
Python Ruby Scala  Scheme   Sgml
SqlSqlMysql SqlPostgresql  Tcl  Texinfo
XmlXslt Yacc

The parsers for individual languages are automatically generated
from Kate syntax definitions.  The xml files have been included
in the repository, together with the program that converts them to
Haskell modules.  There's also a standalone program, Highlight, that
you can use to test the highlighting. (See README for instructions.)

Bug reports and patches are welcome.  Note that I don't want to make
any manual modifications to the generated modules in
Text/Highlighting/Kate/Syntax. Changes should be made either in the
source xml files or in the program ParseSyntaxFiles.hs that generates
these modules.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Pretty-printing peg solitaire boards

2007-11-25 Thread John MacFarlane
You could use Text.Pandoc.Blocks
(http://pandoc.googlecode.com/svn/trunk/Text/Pandoc/Blocks.hs).
Something like this should do the trick:

 boards = map (docToBlock 7) [a, b]-- 7 is width of block
 colon = docToBlock 1 $ text \n\n\n: -- thin block for the colon
 boardSet = render $ blockToDoc $ hsepBlocks $ intersperse colon boards

John

+++ Maurí­cio [Nov 25 07 03:40 ]:
 Hi,

 I'm trying to pretty-print (with Text
 . PrettyPrint . HughesPJ) a set of peg solitaire
 boards. No matter what I try, I always get this:

   00#
   00#
 #00
 000
 000
   000
   000   :   00#
 00#
   000
   000
   000
 000
 000

 but what I really want is this:

   00#   00#
   00#   00#
 #00   000
 000 : 000
 000 000
   000   000
   000   000

 What I'm I doing wrong? When I have two boards
 a,b::Doc, I'm composing them with

 a + colon + b

 and rendering them with just 'render'. Should I
 try something else?

 Thanks,
 Maurício

 ___
 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: Ideas

2007-08-26 Thread John MacFarlane
+++ Andrew Coppin [Aug 25 07 12:50 ]:
 How easy would it be to make / would anybody care / has somebody already 
 made ... in Haskell?
 
 - A wiki program. (Ditto.)

I wrote a simple wiki using HAppS and pandoc.  See demonstration #15
on the pandoc web page:

http://sophos.berkeley.edu/macfarlane/pandoc/examples.html

It's by no means a finished product, but might serve as a good base
if you decide to work on a wiki.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Ideas

2007-08-26 Thread John MacFarlane
 may i ask you what did you had in mind as an application when you started
 that ?

This was just recreational programming: I wanted to see what writing a
web application in Haskell would be like. I think it would be great to
have a fully featured wiki program in Haskell, but I don't have time to
do it myself. Your idea sounds very interesting. Feel free to extend
pandocwiki if that works for you; it's GPL.

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Ideas

2007-08-26 Thread John MacFarlane
lcs can be found at http://urchin.earth.li/darcs/igloo/lcs/

+++ Luc TAESCH [Aug 26 07 23:45 ]:
 when building , i cannot find the lcs mentionned in the cabal file not
 on hasckage nor on goggle.
 could you help?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] strange behavior in Text.Regex.Posix

2007-01-22 Thread John MacFarlane
Can anyone help me understand this odd behavior in Text.Regex.Posix (GHC 6.6)?

Prelude Text.Regex.Posix Text.Regex subRegex (mkRegex \\^) he\350llo @
[EMAIL PROTECTED]

Why does /\^/ match \350 here?  Generally Text.Regex.Posix seems to work
fine with unicode characters.  For example, \350 is treated as a single
character here:

Prelude Text.Regex.Posix Text.Regex subRegex (mkRegex e.l) he\350llo @
[EMAIL PROTECTED]

The problem is specific to \350 and doesn't happen with, say, \351:

Prelude Text.Regex subRegex (mkRegex \\^) he\351llo @
he\351llo

Is this a bug, or just something I'm not understanding?

John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe