Code and Bugs

Coding things

Category: Uncategorized

Simple skeleton for Haskell programs

At my university, there is a course named Programming Paradigms. One of the four languages studied there is Haskell. At a very basic level: type inference, laziness, type classes, pattern matching. No monads, no advanced concepts.

However, there is a Haskell homework and this year we want to test it automatically using vmchecker. This means that the students need to have a skeleton for the I/O parts of the application. In the past, we provided this skeleton but it was always changed from year to year. This time, I’ve tried implementing a generic one.

Thus, io-manager was created. You simply change the Makefile and the main file, run make and run the application providing as command line arguments all the input files that you need. The student only uses simple functions to write/read from this files. In fact, these are simulated, the reads are done lazily before starting the student’s code and the writes are done at the end of the application. All student’s code is pure.

For now there is one enhancement: there should be a cabal file to allow for

cabal install io-manager

in the future.

Entire code is on GitHub, please improve or comment :)

2012 in review

The stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 16,000 views in 2012. If each view were a film, this blog would power 4 Film Festivals

Click here to see the complete report.

PS: I’ll be leaving the WordPress platform as soon as I’ll be making the New Year Resolution.

Think different

Just a simple post to keep interest on this blog while I’m working on the new one based on Yesod.

Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They’re not fond of rules, and they have no respect for the status quo. You can quote them, disagree with them, glorify and vilify them. About the only thing you can’t do is ignore them because they change things. They push the human race forward. And while some may see them as crazy, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.

That’s all for today.

Rebirth from Ashes

Long time ago, when I was discovering the realm of programming and the power this art gives to its wielder, a website was one of the most accessed one, a place full of tutorials and lessons to be learned. Though it was discontinued, the archives were there like a magical spring of knowledge and wisdom.

Today I find out that this site is back. After 7 years flipcode has returned.

RIP Andre

There is no computing project that is worth your life. Turn off the computer. Seek help. Get outside, enjoy the green grass, the birds in the trees. Talk to people you know. Talk to strangers! Drive to Wisconsin, and find out whatever it is they do there. Build a treehouse. Park on a parkway and drive on a driveway. Make a macaroni necklace. Visit a dairy. Climb a rock. Seek life.

(from LWN)

A sad day for programmers, geeks and normal people knowing the state of the matters in Linux world: one of the major contributors to the Linux kernel has died.

A more elaborate opinion, though a personal one and targeting a specific group of people, thus possible unrelated to this event, can be found on the other blog.


This is a post suggested by the previous one and by the incidents which caused it. It is possible to be a very personal post but it will also contain some objective pieces of information. Keep this in mind while reading.

Read the rest of this entry »

Packaging Hell Problems

Because the move to a new blog was imminent, I decided not to post anymore on this blog. However, I’ve encountered a problem which prompted me to do this.

Read the rest of this entry »


Is this what you want?

Think again please.


Recently I discovered the joy of answering questions on Stack Overflow. I had a SO account for two years but I didn’t use it until a few weeks ago. This article started after receiving a little feedback on one of my answers.

As you see, I was trying to give a benchmark for those two cases. Yet, it was reported as being an ugly hack and not a try at comparing two solutions. I post this short article here not because I wanted a place to cry that I was criticized but because I desired some advice on what should a good benchmark contain and how to write a proper one.

Thanks :)

Parsing text in Haskell with Alex

Recently I remembered that I’ve started HaCoTeB as a project in which to test text lexing and parsing with Alex and Happy. Things didn’t work so well and HaCoTeB died without a single Alex specification file written.

However, during this little free time I had this week, I tried again to parse a simple text file with Alex.

Read the rest of this entry »


Get every new post delivered to your Inbox.