domingo, 29 de mayo de 2011

Week #1

In my last post I just introduced a bit the project I will be working on this summer. Of all the features I proposed, I decided to start with the Browser, because it seemed the most orthogonal to the rest of EclipseFP, and a good way to learn about Scion and Eclipse APIs.

I started with a parser for Hoogle files written in Parsec. The information was saved using several custom data types for each kind of element in the database, and serialized to disk using binary. Here I already faced some problems, mostly due to laziness in the parsing, which created a very large memory footprint, so I decided to move to cereal to make the parsing.

After that, my mentor Thomas suggested some improvements for the code. One of it was to use the haskell-src-exts (since now, HSE) package to save information about elements. That turned to be a great idea, because HSE has special datatypes for annotated syntax elements and comes with parsers for some parts of the syntax I could reuse. In that way I could rewrite the parsing of Hoogle files, getting a neater code.

I was still having some problems with memory consumption, so I've been learning about the text and bytestring packages for better string handling. I also changed from automatic derivation of Data.Serialize instances using derive to manual writing of it, in order to implement a lookup tables for common names. That cut the memory footprint a lot, because Haskell type signatures tend to reuse names (such as "a" or "b" for type variables) and a lot was gained by not creating a new instance of Type each time one appeared.

That's all for this week. Until now, I've been making the changes into a separate repository from Scion, but next week I plan to merge my work on it.

No hay comentarios:

Publicar un comentario