[Haskell-cafe] Why are OCaml and Haskell being used at these companies?

Laurent Deniau laurent.deniau at cern.ch
Wed Nov 14 05:57:00 EST 2007

Jon Harrop wrote:
 > On Tuesday 13 November 2007 16:03, Laurent Deniau wrote:
 >> OCaml was used to write a meta-program which applies heuristics to
 >> minimize the runtime of the critical C code (i.e. the butterflies). This
 >> has nothing to do with FFT computation
 > No. The sole purpose of the OCaml code is to symbolically simplify 
the FFT computations and generate C code implementing the best results.

Which is not needed by default. 'Standard' codelets are already present 
in the source distribution and far enough for most uses. I have been 
installing FFTW on a dozen of archs over the past 10 years and I have 
never used the OCaml code (in fact I did it once to play with it).

 >> FFTW doesn't need any OCaml compiler or lib to be compiled and 
 > No. FFTW contains around 13,000 lines of OCaml source code and you 
need the OCaml compiler to compile that.

Yes you need a OCaml compiler to compile the OCaml code. But you don't 
need the OCaml code to install FFTW, except if you want to generate your 
own codelets which remains an exceptional case.

 > If you don't believe me, perhaps you will believe Steven G. Johnson 
(one of the authors of FFTW) when someone tried to tell him that he 
hadn't written his software in OCaml:
 > http://groups.google.co.uk/group/fa.caml/msg/cfd08423c22ccff5

I am not saying that the FFTW distribution doesn't have OCaml code nor 
this code is negligeable/useless! I just say that it is useful to build 
the codelet for unsupported size or to tune them for a given arch. The 
libfftw itself, the only part meaningful for your program performance 
and used by MATLAB, is entirely made of compiled C and asm code. Just to 
quote the doc:

[ section 8.4 "Generating your own code"
The directory genfft contains the programs that were used to generate 
FFTW’s “codelets,” which are hard-coded transforms of small sizes. We do 
not expect casual users to employ the generator, which is a rather 
sophisticated program that generates directed acyclic graphs of
FFT algorithms and performs algebraic simplifications on them. It was 
written in Objective Caml, a dialect of ML, which is available at 

So your assertion "the FFT routines in MATLAB (FFTW: written in OCaml)" 
is simply wrong or at least an ambiguous shortcut. MATLAB doesn't run 
OCaml code in its FFT routines.

 > That OCaml code has millions of industrial users worldwide and is one 
of the most widely used pieces of software written in a statically typed 
functional programming language.

And OCaml was (still is?) the language learnt by French students in the 
90's in the 'classes preparatoires'. At least when I was teaching 
scientific computing. I am not a language fanatic, so this kind of 
argument is simply meaningless for me. It is important only if am 
developing projects with long lifetime, high portability or sparse 

a+, ld.

More information about the Haskell-Cafe mailing list