Min-Max GHC command line error bytes to bytes of source code

3

1

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.

Kyle McKean

Posted 2019-01-03T01:15:27.710

Reputation: 31

1Related. I suspect an answer inspired from there could be quite competitive. And probably (I'm pretty confident) could have an unbounded score – H.PWiz – 2019-01-03T01:24:16.427

1yep – ASCII-only – 2019-01-03T01:38:25.283

12.9MB already – ASCII-only – 2019-01-03T01:40:59.187

2I recommend looking into [tag: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. – Nathan Merrill – 2019-01-03T02:33:27.543

1

@ASCII-only Your program’s score of 2919209/2^(8 + 30) ≈ 0.0000106 is handily beaten by the empty program’s score of 142/2^(8 + 0) = 0.5546875. However, the winning constructions at Make a long type signature are doubly-exponential, so you can get an unbounded score. I don’t think this scoring system is going to work.

– Anders Kaseorg – 2019-01-03T08:31:00.537

@AndersKaseorg Yeah, definitely. Even that challenge has a length limit because of the same issue. Alternatively, maybe you could count type names as one byte long – ASCII-only – 2019-01-03T08:38:40.237

@AndersKaseorg I was trying to solve the sensitivity around 0 with the plus 8. Do you have a better scoring method? – Kyle McKean – 2019-01-03T09:31:29.087

2The 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? – Anders Kaseorg – 2019-01-03T09:40:32.453

1Also with that formulation, there’s probably no need to ban specific features like Template Haskell because it probably costs more bytes to use them than the shortest program to produce 1000000 bytes of errors. In fact, you could open the challenge up to any language with a concept of compile errors, not just Haskell. – Anders Kaseorg – 2019-01-03T09:58:45.723

@ASCII-only This is beautiful! :) – flawr – 2019-01-12T23:43:00.303

@flawr I stole it off the linked question though – ASCII-only – 2019-01-13T00:54:16.093

No answers