I wrote a little word counting tool to help with my writing recently, and I figured it would make for a good response to Michael Snoyman's post here on telling Haskell success stories.

wordchoice turned out to be a dang nice tool. You can run it basically any document containing your writing (TeX, markdown, HTML, Word document) and it will spit back your most frequently used words, so that you can see which ones are being overused or just to compare authors. It's the sort of thing you can show off to your friends that don't program.

Part of why the project was so successful was not just that Haskell was adequate or practical for the job, but because Haskell's libraries (particularly pandoc) made the task far easier than it would have been in another language. Pandoc is notably better than python's mishmash of packages and rust is too young to even have a library to parse word documents.

In the end, about a third of the code I wrote was boilerplate for command-line options parser -- not because of the parser's prolixity but rather the ease of incorporating libraries in Haskell and Haskell's rich ecosystem.

Haskell is also fast. Finding the all most commonly used words in Ulysses takes around 500ms on my computer, well within comfortable for a command-line program. Cross compiling is a pain, but given my use case (documents I'm editing) that doesn't really matter.

Finally, I would also like to note that this project was relatively easy -- I saw something I wanted that a computer could do and executed it in a few hours with under 200 lines of code. Haskell isn't always easy when you're learning (and my code does use lens), but it's doable. Haskell is written by humans.

What does this say about using Haskell in the "real world"? I don't know. People always have an agenda when they bring that phrase up. But I absolutely can say Haskell is an incredible tool that allows you to say "a computer really should be able to do this" and have a command-line tool a few hours later.1 It's hard to understate quite how important that is.

1: Though perhaps it is due to lack of experience, this is not the experience I have had with python or bash. Any script that takes a few hours to write ends up having many runtime errors down the line.