Commit new blog post on Haskell and Clojure

This commit is contained in:
Sanchayan Maity 2017-02-15 02:13:15 +05:30
parent 01d0d50249
commit e2814139f9
1 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,66 @@
---
author: Sanchayan Maity
title: Another Haskell and Clojure Post
tags: haskell, clojure
---
<p style='text-align: justify;'>Been a while since I wrote about anything here
but it's time to be regular about this again. And oh no! Another Haskell and
Clojure post, just like so many others on the web. Well this will be about my
experience.</p>
<p style='text-align: justify;'>I don't remember how I heard about Haskell the
first time, but, since then I have tried at least thrice to pick it up. Two times
I tried with the book Learn You a Haskell for great good and the other time I
tried referring Real World Haskell. Neither of them stuck with me, even though
the LYAH book is recommended quite a lot. This last June I came across Haskell
Programming from First Principles. After reading the reviews online and checking
out a pirated copy, I decided it was definitely worth it. Yes, I had an ebook
version of it, but I still bought it on my birthday after spending 4000+ INR on
it. I gave it as a present to myself and boy was it worth it, worth every penny.
</p>
<p style='text-align: justify;'>Let's digress a bit to talk about Clojure and
we will come back to Haskell in a while. I was also trying to learn Clojure for
a while now. Having read about "code is data and data is code" in the context of
LISP languages, I wanted to try it out. The only dialect worth trying it seemed
to me was Clojure. Now while I do not care about Java and find it too verbose,
it cannot be denied that the JAVA ecosystem gives one access to a lot of things.
And while I might not land a Haskell job in India, I might just land one with
Clojure. So seemed practical as well.</p>
<p style='text-align: justify;'>I was taking CS 425 Database class in the summer
semester and the professor wanted us to do a JDBC assignment with one of RDBMSes.
I thought what better oppurtunity than this to try some Clojure. So I wrote an
application in Clojure which automates running of TPC-H queries for measuring
database performance. I used the JDBC driver for Postgres.</p>
<p style='text-align: justify;'>Coming from C which is a weakly typed language
Clojure's dynamic typing did not go well down with me. While it was fun to
program in Clojure, but, I would make stupid mistakes and then only find them
at run time. This is a problem with all dynamically typed languages. There is
the source to sink problem. The origin point of error would be somewhere else
and the stack trace or exception would originate somewhere else. This is not
at a problem while programming in Haskell. Haskell's strong typing nature can
catch all such errors at compile time. I personally prefer this. Stupid people
like me who cannot keep all of the code in the head at any given time, prefer
to leverage the type system and compiler for not facing such problems.</p>
<p style='text-align: justify;'>Haskell's code is also much more pleasing to my
eyes than Clojure/LISP's parenthesis style since I find the former easy to parse
than the latter. Although LISP style makes sense since it is an abstract tree
representation as well of the code, but, still nah!. Though given a choice to
not work in Embedded/C and with no Haskell shop around, I would like to work in
Clojure.</p>
<p style='text-align: justify;'>So I am trying to learn Haskell at the moment
from the Haskell book and currently at Foldable chapter. Ten more chapters to
go before I can call myself a beginner Haskeller. After that it will be time
to learn some Yesod and go through Simon Marlow's Parallel and Concurrent
Programming in Haskell. Also I have now switched from using Jekyll for my blog
to using Hakyll. The blog as is currently, is in pretty early stage. I have some
things to figure out like taking care of code snippets and highlighting them
properly. But using Hakyll will also allow me to play around with Haskell. I
do not give a crap about Ruby anyway on which Jekyll is based. Also intend
to switch to xmonad from i3, however my xmonad configuration still requires some
work before I can make it work just like i3.</p>