From UBC Wiki

Path to Philosophy

Authors: Jamil Koller, Maike Basmer

What is the problem?

We want to implement the Reddit Dailyprogrammer Challenge Path to Philosophy. In the challenge description, it is stated that starting from any article in wikipedia and clicking the first link in every subsequent article, one will eventually get to the article about philosophy in ~ 95% of the cases. In the other cases, the search ends up in a cycle or on a wiki page without a link. The goal is to output the titles of the articles that have been visited on the way to the philosophy article.

By implementing that program, we want to explore how we can implement algorithms in general and specifically how to interact with the web using Haskell.

What is the something extra?

  • Cycle detection
  • Take a random wikipedia page as starting point

What did we learn from doing this?

What is the bottom-line? Is functional programming suitable for (part-of) the task? Make sure you include the evidence for your claims.

For implementing the interaction with wikipedia's API and reading JSON, we extensively employed libraries like http-conduit and aeson. Having only limited knowledge of Haskell, it was sometimes hard to understand the functionality of particular functions, what they expected as input and returned as output. Especially when the use of the functions turned out to be way more difficult and not as obvious as demonstrated in the tutorial, we had to struggle with the actual source code in order to progress. In general, Haskell's type system confused us several times, especially when monads came into play.

With regard to the wikipedia API, we first hampered with the returned JSON format since the page ids were used as the keys for JSON objects, thus the corresponding field name would have had to be set dynamically. Eventually, we found a workaround for that issue. Generally, parsing wikitext would be theoretically quite easy if it would be employed more uniformly.

However, we learnt a lot about applying Haskell in some real-life scenario by facing all those difficulties. There might be programming languages that allowed for easier interaction with web APIs but we were surprised how concisely this part could eventually be implemented and how smoothly the conversion between JSON and Haskell data can be realized (thanks to the libraries). So, it is definitely suitable for this task. Yet, we did feel like taking advantage of that many functional features (on the surface), so we did not really had the impression to make use of Haskell's strengths.

The source code for our project can be found here ( in the directories src and app):