14 Aug 2007

n00b Thoughts on Haskell

Posted by elfasbrynja

I toyed with the idea of learning a functional programming language before. It’s good to see that toying often eventually leads to doing, as has been the case with Swedish. Some things that eventually prompted me to pursue FP more were an excellent article on the subject and personal experience with tedious maintenance of state in an ugly ‘monster class’ Python program I wrote. I thought that perhaps obsession with remaining functional and encapsulating state as much as possible—via monads, the mysterious components with which Haskell compilers reproduce—is perhaps a good idea. I still love object-oriented programming, especially in Python, because it is so easy, but FP makes anything imperative look like troglodyte crap now.

I have done some exercises and read parts of Yet Another Haskell Tutorial, among a few others. At this point, I have only recently learned a new distinction between ‘classes’ (like ‘interfaces’ in Java) and ‘types’ (more or less like ‘classes’ in other languages), and am barely qualified to comment on the matter, but that never stopped me before. Haskell is interesting in that, without monads, no program written in Haskell would ever ‘run’. Pure Haskell, like a system of equations, cannot ‘run’. It simply is. That sounds like ‘crystallogy weenie and pipe-stress freak’ substance until you consider that functional programming languages such as Haskell are inherently thread-safe and allow foolproof test units. Overall, it seems to be a very rich, powerful and concise language. The well-known quicksort implementation is a good example:

quicksort :: Ord a => [a] -> [a]
quicksort  []           =  []
quicksort (x:xs)        =  quicksort [y | y <- xs, y<x]
                        ++ [x]
                        ++ quicksort [y | y <- xs, y>=x]

Five lines, including (an automatically deducible) declaration. It could probably fit into three. Haskell pwns n00bs.

I remember that object-oriented programming used to be considered an academic toy, used only by ivory-tower chair-polishers who drink liberal tea and eat quiche. Since then, OO has not only come into mainstream acceptance, it has also become a meaningless buzzword fit for the meager intellects of PHBs. I wonder whether Haskell and other FP systems will meet the same fate one day. In any case, I will remain faithful to Haskell, so no one can claim that I jumped on the bandwagon and avoid the turgidity usually associated with bandwagons (e.g., XML).

Well, second post in and I’m quite ready for Hank Dagny to step in and decry the liberal decadence of ‘lazy evaluation’.

Subscribe to Comments

No Responses to “n00b Thoughts on Haskell”

  1. Hi there, I enjoy reading through your article post. I like to write a little comment
    to support you.



  2. I absolutely love your website.. Great colors & theme.
    Did you make this website yourself? Please reply back as I’m hoping to
    create my very own blog and would like to know where you got this from or just
    what the theme is called. Many thanks!


    quest bars nutrition

  3. Hey there! I simply would like to offer you a big thumbs up for the great
    info you’ve got here on this post. I’ll be returning to your blog for more soon.

  4. This paragraph is really a nice one it assists new the web
    users, who are wishing for blogging.

  5. I have read so many articles or reviews on the topic of the
    blogger lovers however this post is in fact a fastidious paragraph,
    keep it up.

  6. you are in reality a excellent webmaster. The website loading
    velocity is incredible. It seems that you are doing
    any distinctive trick. In addition, The contents are masterwork.
    you’ve done a fantastic task on this matter!


    kroger Digital Coupons

  7. If you desire to improve your familiarity simply
    keep visiting this web page and be updated with the newest news update posted here.


    kroger coupons

  8. Helpful info. Fortunate me I discovered your website unintentionally,
    and I am shocked why this coincidence did not happened earlier!
    I bookmarked it.

  9. Hi my name is Sandra and I just wanted to drop you a quick note here instead of calling you. I discovered your Dum Pendebat Filius » Blog Archive » n00b Thoughts on Haskell page and noticed you could have a lot more hits. I have found that the key to running a popular website is making sure the visitors you are getting are interested in your niche. There is a company that you can get targeted visitors from and they let you try their service for free for 7 days. I managed to get over 300 targeted visitors to day to my website. Visit them here: http://ittsy.com/it/3x



Leave a Reply