Posts

Showing posts with the label literate

Converting between Bird-literate and plain Haskell

Literate programming is a good idea, and there exist many creative ways in which you could take advantage of it, like one described in Literate Haskell with Markdown and Syntax Highlighting . However, if you're using the text editor Geany version 0.18, you will be faced with a bug that makes it unable to interpret Bird-style literate source. As a simple fix, I provide two programs to convert between simple Bird-literate and non-literate source code. You could also convert your Bird-literate to TeX-style . # bird_lhs2hs sed '   s/^>//   t   s/^ *$//   t   s/^/-- /  ' in.lhs > out.hs # hs2bird_lhs sed '   s/^-- //   t   s/^ *$//   t   s/^/> /  ' in.hs > out.lhs

Literate programming

I am interested in doing hobby projects in literate Haskell and similar techniques. The main idea is that you shall not need to mark where comments are, but instead to mark where code is. In practice, this can save you quite some time. Just imagine writing your research paper and the demonstration program at the same time! It also sounds pretty powerful for coursework. And as a side note, it reads much better, because of the proximity of description and the respective code implementing it. I have had missed this property since the first time I've made technical documentation for a program.