Posts

Why is Haskell used so little in the industry?

Bugspy asked an interesting question on Stack Overflow recently: It is a wonderful, very fast, mature and complete language. It exists for a very long time and has a big set of libraries. Yet, it appears not to be widely used. Why ? I suspect it is because it is pretty rough and unforgiving for beginners, and maybe because its lazy execution makes it even harder Jeff Atwood, cofounder of Stack Overflow, has since closed the question for being subjective and argumentative. Sadly, Marc Gravell chose to edit my answer and delete half of my comments so the discussion no longer makes sense. However, my response will be of interest to anyone considering gambling their own money on Haskell so I shall repeat it here. The first point of interest is Norman Ramsey's meta-answer which was written from his point of view as an academic. Norman explains why he believes that major institutes have already made "great use" of Haskell: "Don't tell that to Credit Suisse or Standa...

Purely functional Heap Sort in OCaml, F# and Haskell

Here's Markus Mottl's OCaml translation of Okasaki's purely functional leftist heap: module LeftistHeap (Element : ORDERED) : (HEAP with module Elem = Element) = struct module Elem = Element type heap = E | T of int * Elem.t...

Variant types and pattern matching in HLVM

The compiler development series of articles in The OCaml Journal have culminated in an example front-end compiler targetting HLVM that now supports variants and pattern matching in addition to previous features. These new language features have been implemented using only a few lines of code, bringing the front-end up to only 253 lines of OCaml code! This new functionality allows substantially more complicated ML-style programs to be written, including the following symbolic simplifier: # type expr = Int of int | Var of int | Add of expr * expr | M...

ML's powerful higher-order module system

For around 30 years, the ML family of languages have been characterised by several unusual features including a novel and powerful higher-order module system. This language feature was pioneered by Dave MacQueen in the early 1980s and found its way into the Standard ML and OCaml languages. Higher-order modules allow one module to be parameterized over another module in the form of functors that map modules to modules. Higher-order modules turn out to be especially useful for parameterizing concrete data structures over more primitive data structures. Perhaps the most compelling application of higher-order modules comes from graph theory, where they allow algorithms over graphs to be abstracted over the concrete data structures used to represent the graphs. This application was discussed in our most recent OCaml Journal article " The A* algorithm " that describes a generalization of Dijkstra's shortest path algorithm that is widely used for route finding in game AI. Th...

Bubble sort in a Mathematica pattern

The Mathematica programming language has many unusual characteristics, two of which are: Everything is an expression. Pattern-based rewrite rules are obscenely powerful. These kinds of characteristics are the foundation of what makes Mathematica a powerful programming language. For example, the bubble sort algorithm can be implemented in a single line without a loop in Mathematica using a single conditional rewrite rule that exchanges adjacent elements when they are out of order: bubble[xs___, x_, y_, ys___] := bubble[xs, y, x, ys] /; x > y This definition causes a new rewrite rule to be injected into Mathematica's global table of rewrite rules. Mathematica then applies this rule to any subexpression it sees that has the form bubble[..] . The pattern on the left side of the rule searches for a pair of adjacent arguments ( x and y ) to bubble where x>y . If the pattern matches then the expression is rewritten such that x and y are exchanged. This example not only demonstra...

KDE 4 drove us to Windows Vista

We just finished a week of hell after trying and failing to upgrade from Debian Lenny to Debian Squeeze. None of the Debian Linux kernels working correctly on our stock Dell PowerEdge T605 hardware was the first major headache and KDE 4 was the second. In our 10 years of using Linux its user unfriendliness seems to be as poor as ever. With the latest KDE 4, it seems that KDE itself has also gone from bad to worse. We migrated from Gnome to KDE many years ago because we found Gnome to be buggy and user unfriendly only to discover that KDE was only superficially stable. KDE 4 takes this to a new level and our log files are filled with records of segfaults. KMail was once riddled with serious bugs but these were ironed out in KDE 3 and it became a usably-stable e-mail client a few years ago and served us well. Not so with KMail from KDE 4, which regularly segfaults, losing and/or corrupting data and has consistently failed even to move significant numbers of e-mails around within its own ...

The HLVM Reddit

The Reddit user ethicszen has kindly created a subreddit for HLVM-related news and discussion . Please post links to interesting HLVM articles there. Also, don't forget to join our mailing list if you want to hear what is going on or discuss HLVM in any way.