5 / 5
Jul 2004

What runtime options are used for haskell programs, if any?
For example on problem 41 (Play on Words) I've written a recursive algorithm to process the testcases (and don't know, how to formulate that iteratively). Therefore I need a stacksize of at least 3.8 MB (testet locally on ghc 6.0.1) to solve the input:

(100000 times "zz")

If compiled without the -O flag, I need even much more memory.

So, if I execute the command sequence

I get correct results, whereas other combinations (without RTS or -O) print out

I also would appreciate to know, if this error message is treatet as Wrong Answer or Runtime Error by the judge system, because I got wrong answer on my submission, but I suppose, this error had occured.

Best regards,
Robin

  • created

    Jun '04
  • last reply

    Jul '04
  • 4

    replies

  • 463

    views

  • 5

    users

Right now, no runtime options, actually.. And compiled without the "-O" switch.
I'll do a bit of testing and adjust the options, as you suggest.

It's exactly that case.
Right now, it's treated as WA (compiled succesfully, program exited on it's own and wrote nothing to stdout); it will be changed to "runtime error (non-zero exit code)" soon.

16 days later

Hello, I would like to know if ghc compiler directives can be included in the source code, like this:

{-# OPTIONS -O #-}

In some cases -O produces a significant speedup:

$ ghc prime1.hs -o prime
$ time ./prime < prime1.test > prime1.dat
real 0m37.516s
user 0m36.970s
sys 0m0.150s

$ ghc -O prime1.hs -o prime
$ time ./prime < prime1.test > prime1.dat
real 0m4.120s
user 0m3.970s
sys 0m0.010s

I have tried {-# OPTIONS -O #-} in the source code but again I get TLE. If the option has been accepted then my program is clearly wrong...

Thank you for your help,

Alberto

They can. We will probably block them some time in the future.

Optimisation is on by default (noix's post is somewhat out of date), and the compiler command line is something like:

ghc tested.hs -O --make

for both Haskell 5 and 6.

Passing the -O2 option in your source code may result in a slight speed boost, but I wouldn't count on it to help you get AC for your solution wink.

BTW. Thanks for posting your solution to TEST, I've deleted mine smile.

24 days later

They can. We will probably block them some time in the future.

Please don't! I need my -fallow-overlapping-instances and -fglasgow-exts.

Also, it would be nice to be able to use generic classes, for which we need -package lang, which can't be done via an OPTIONS pragma.