Online judge and Haskell?

Tomasz Zielonka
Mon, 28 Apr 2003 21:41:23 +0200

On Mon, Apr 28, 2003 at 08:24:12PM +0200, Steffen Mazanek wrote:
> Hello,

> it's me again and I have a new mad idea.
> There are a lot of programming contests out there
> and unfortunately most (all?) of them do not allow 
> Haskell code till now!
> I think, this is hard to accept. 

I agree wholeheartedly.

> Why not ask the people which run 
> to provide their problem sets, input and output files
> and the basic judging software and install it at 

I think the best would be to convince them to allow Haskell solutions in I don't think that they will reveal input
and output files - I surely would not.

Having Haskell amongst languages supported by this site would have many
  a) you could compare Haskell programs to programs in other languages
     (but only in terms of efficiency, not programming techniques).
  b) you could use your existing account on this site (I have one)
  c) other contestants could get interested in learning Haskell

> I think an adaption of this software to permit Haskell code can not be
> that difficult!

I think there would be some work in ensuring security. They don't run a
complete virtual machine (like in VMware or Bochs) to guard against
malicious programs. They simply don't allow to use some functions. One
of possible judge responses is:

     * Restricted Function (RF): Your source program tried to use a not
       allowed function (such as fork(), fopen(), ...)

One way of enforcing polite behaviour of Haskell programs could be to
accept only modules with function

  solve :: String -> String

which would be run with interact, and to disallow all functions which 
can break referential transparency, like unsafePerformIO. Or am I
missing something?

I have already tried to convince them to include some FP. Here is the
response I got:

> From Fri Aug  9 22:39:11 2002
> From: "Carlos Marcelino Casas Cuadrado" <>
> To: "Tomasz Zielonka" <>
> Subject: Re: How about supporting some functional language?
> Date: Fri, 9 Aug 2002 22:24:31 +0200
> Dear Tomasz Zielonka,
> First of all thank you for your help, but we are not thinking about installing
> another languaje on the judge. We still have some problems with Pascal, and we
> haven't finished installing Java (it has a lot of security problems). We prefer
> make Pascal and Java work before installing another one.  Maybe on the future
> we'll consider installing OCaml or some other (a lot of people ask us about a
> lot of them).
> Thanks again.
> Carlos.
> PS: Anyway, the ACM contest only allows C(C++), Pascal and Java (well, they used to).
> ----- Original Message -----
> From: "Tomasz Zielonka" <>
> To: <>
> Sent: Wednesday, August 07, 2002 12:21 PM
> Subject: How about supporting some functional language?
> > Hello!
> >
> > What is your opinion on adding some functional programming language to
> > the list of languages supported by the judge?
> >
> > When I solve programming problems, I often start with a prototype in a
> > FPL like Haskell, Clean, SML or OCaml. Sometimes this prototype, being
> > prototype after all, is too slow or consumes to much memory. But often
> > it is as efficient as a program I write later in C or C++. I would be
> > very happy if I could just send this program and move on to other
> > problems.
> >
> > I have good experience with using FPL in programming contest. There was
> > an online programming contest in Poland, called Pogromcy Algorytmow
> > (Algorithms Busters or Algorithms' Busters). In this year's edition one
> > could use Pascal, C, C++ and OCaml to write the solutions. I used OCaml
> > in 9 out of 13 problems and I don't regret that.
> >
> > I imagine that you wouldn't install all of the languages I mentioned,
> > but probably one of them.
> > If you are willing to consider my proposition, I can offer my help in
> > choosing the language, its implementation and tayloring it for use in
> > online programming contest.
> >
> > Best regards,
> > Tom

Who knows, maybe they would be willing to support Haskell now?
Especially, if it would be just that easy to ensure security.

> Ciao,
> Steffen

Best regards,

.signature: Too many levels of symbolic links