The Haskell Error Index Lassi Kortela (01 Jul 2024 12:51 UTC)
Re: The Haskell Error Index Stephen De Gabrielle (01 Jul 2024 13:08 UTC)
Re: The Haskell Error Index Arthur A. Gleckler (01 Jul 2024 13:32 UTC)
Re: The Haskell Error Index Jakub T. Jankiewicz (01 Jul 2024 16:33 UTC)
Re: The Haskell Error Index Arthur A. Gleckler (01 Jul 2024 16:45 UTC)
Re: The Haskell Error Index Lassi Kortela (02 Jul 2024 09:31 UTC)
Re: The Haskell Error Index Maxim (05 Jul 2024 16:10 UTC)
Re: The Haskell Error Index Lassi Kortela (08 Jul 2024 11:14 UTC)

Re: The Haskell Error Index Maxim 05 Jul 2024 16:10 UTC

Lassi Kortela, 2024-07-01 15:51 +0300:
> This looks like a good idea:
>
> https://errors.haskell.org/
>
> https://github.com/haskellfoundation/error-message-index
>
> They are trying to make baffling error messages intelligible by providing
> examples and explaining some background.

Two other good cases in point (including specific error numbers
mentioned down the thread) are ShellCheck and Rust.

ShellCheck has an online database with examples of errors and fixes,
rationale, etc.:

    🚀 shellcheck some-shell-script

    In some-shell-script line 127:
            local path url body
            ^-----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.

    For more information:
      https://www.shellcheck.net/wiki/SC3043 -- In POSIX sh, 'local' is undefined.

I personally would rather prefer to be offline-first and avoid putting
details behind an URL, like rustc's --explain option:

    🚀 cargo build
       Compiling hello v0.1.0 (/tmp/hello)
    error[E0308]: mismatched types
     --> src/main.rs:2:18
      |
    2 |     let x: i32 = "oops";
      |            ---   ^^^^^^ expected `i32`, found `&str`
      |            |
      |            expected due to this

    For more information about this error, try `rustc --explain E0308`.
    error: could not compile `hello` (bin "hello") due to 1 previous error

    🚀 rustc --explain E0308
    Expected type did not match the received type.

    Erroneous code examples:

    fn plus_one(x: i32) -> i32 {
        x + 1
    }

    plus_one("Not a number");
    //       ^^^^^^^^^^^^^^ expected `i32`, found `&str`

    if "Not a bool" {
    // ^^^^^^^^^^^^ expected `bool`, found `&str`
    }

    let x: f32 = "Not a float";
    //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str`
    //     |
    //     expected due to this

    This error occurs when an expression was used in a place where the compiler expected an expression of a different type.
    It can occur in several cases, the most common being when calling a function and passing an argument which has a different
    type than the matching type in the function declaration.