codewars / codewars-runner-cli

Old CodeRunner project. See https://github.com/codewars/runner instead.
GNU Affero General Public License v3.0
402 stars 141 forks source link

A problem with optimization flags in Haskell katas (GHC 7) #740

Closed Nesterov-Konstantin closed 5 years ago

Nesterov-Konstantin commented 5 years ago

Describe the bug

Looks like I can't enable code optimization for haskell katas through GHC_OPTIONS pragma. I am aware that compler is being run with --interactive flag and that spoils the fun. i.e. this kata https://www.codewars.com/kata/simple-assembler-interpreter/train/haskell/5cd9979da695ae0015f9106a has a pretty heavy test for final submission, which takes 0.5 seconds if Haskell is compiled and over 2 hours if not.

I assume there is a way to turn on optimization for such katas, or this is a bug, that blocks Haskell users.

To Reproduce

Using {-# OPTIONS_GHC -O -fobject-code #-} leads to a ghc panic (this is a ghc bug due to interactive mode is on for ghc). Using {-# OPTIONS_GHC -O #-} leads to a message that optimization is skipped for interactive mode

Expected Behavior

I should be able to enable compiler optimization in order to pass relatively heavy tests.

kazk commented 5 years ago

This is supported when using Haskell GHC 8 (#699). We've been migrating off of GHC 7.10 so please let the author know to update it.