3
\$\begingroup\$

GHC command line errors can be horrible, lets make them as bad as possible. To disincentivize very long programs use the following formula to calculate your "score".

(# of bytes of GHC output) / 2^(8 + # of bytes of code)

Template Haskell is banned as there is probably a TH configuration where you can replicate an error f(n) times where f is an arbitrary fast growing computable function. CPP and GHC options are banned for similar reasons.

GHC output should be computed using this release of GHC 8.6.3.

To calculate the bytes of GHC output run:

ghc -hide-all-packages -package base Main.hs |& wc -c

The following is an example submission:

main = print (1 + True)

Error:

[1 of 1] Compiling Main             ( Main.hs, Main.o )

Main.hs:1:15: error:
    • No instance for (Num Bool) arising from a use of ‘+’
    • In the first argument of ‘print’, namely ‘(1 + True)’
      In the expression: print (1 + True)
      In an equation for ‘main’: main = print (1 + True)
  |
1 | main = print (1 + True)
  |               ^^^^^^^^

Score:

375 / 2^(8 + 24) = 0.0000000873114914

Submissions must contain the code and the score. Highest score wins.

\$\endgroup\$
  • 1
    \$\begingroup\$ Related. I suspect an answer inspired from there could be quite competitive. And probably (I'm pretty confident) could have an unbounded score \$\endgroup\$ – H.PWiz Jan 3 at 1:24
  • 1
    \$\begingroup\$ yep \$\endgroup\$ – ASCII-only Jan 3 at 1:38
  • 1
    \$\begingroup\$ 2.9MB already \$\endgroup\$ – ASCII-only Jan 3 at 1:40
  • 2
    \$\begingroup\$ I recommend looking into busy-beaver challenges. In particular, for these kinds of challenges, I often recommend a maximum length, and a requirement that the program must eventually halt. \$\endgroup\$ – Nathan Merrill Jan 3 at 2:33
  • 2
    \$\begingroup\$ The plus 8 doesn’t do anything except uniformly divide all scores by 256. I think it’s going to be hard to find something that isn’t totally arbitrary and doesn’t strongly favor either the empty program or programs compiling with too many errors to fit in the visible universe. Maybe the challenge should be to find the shortest program that produces at least (say) 1000000 bytes of errors? \$\endgroup\$ – Anders Kaseorg Jan 3 at 9:40

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.