Skip to content
DevMeme
6470 of 7590
Compilers Post #7094 · source on Telegram

Haskell Compiler Bug Where Disabling Warnings Breaks Instance Resolution

Description

A screenshot with white text on dark background describing a Haskell compiler bug discovery. The text reads: 'Today after an hour of "the fuck can possibly be wrong here???" I found another bug in the Haskell compiler. Disabling already disabled warnings breaks basic code in the most cryptic way imaginable. Programmers do deserve this. It's divine punishment for making the rock think.' Below is a GitHub issue titled 'Disabling warnings breaks instance resolution' (Open, created by effectfully). The issue shows a Haskell code snippet: '{-# OPTIONS_GHC -Wno-all #-}' followed by 'main = print $ Just () == Nothing' which fails with error '[GHC-39999]: No instance for `Eq (Maybe ())` arising from a use of `==`'. The bug demonstrates that adding -Wno-all pragma somehow breaks type class instance resolution for basic Eq comparisons

Comments

12
Anonymous ★ Top Pick 'Programmers deserve this. It's divine punishment for making the rock think.' -- and Haskell programmers deserve it doubly, because they made the rock think about types, monads, and category theory until even the compiler lost track
  1. Anonymous ★ Top Pick

    'Programmers deserve this. It's divine punishment for making the rock think.' -- and Haskell programmers deserve it doubly, because they made the rock think about types, monads, and category theory until even the compiler lost track

  2. Anonymous

    Turns out `-Wno-all` quietly promotes every warning to a full-blown existential crisis - proving that in Haskell even the compiler practices lazy error disclosure

  3. Anonymous

    After 20 years in the industry, you realize the real bug is that we convinced silicon to have opinions about type equality, and now it's getting revenge by making instance resolution dependent on whether you asked it to shut up about other problems

  4. Anonymous

    Ah yes, the classic Haskell experience: spend an hour debugging your perfectly valid code, only to discover the compiler itself is having an existential crisis about whether warnings should affect type inference. It's like the GHC team decided that '-Wno-all' should mean 'no, all your instances too.' At least when you're fighting the borrow checker in Rust, you know it's *your* fault - but in Haskell, even the compiler can gaslight you into questioning whether Maybe really does have an Eq instance. This is what happens when you give a sufficiently advanced type system enough rope: it doesn't hang itself, it just silently breaks instance resolution and watches you suffer

  5. Anonymous

    Apparently -Wno-all means “no warnings and no typeclass dictionaries” - silence the linter, and Eq quietly rage-quits; peak compiler-as-feature-flag energy

  6. Anonymous

    Haskell's type checker: 'You disabled my warnings? Fine, now explain why Nothing won't show itself.'

  7. Anonymous

    Only in GHC can -Wno-all erase Eq (Maybe ()): when diagnostics mutate semantics, you didn’t disable warnings - you enabled quantum compilation

  8. @Algoinde 11mo

    i mean their fault for using haskell

  9. @Trlloik 11mo

    How's that type safety, asshole?

    1. @TheFloofyFloof 11mo

      Found the c dev

      1. @Trlloik 11mo

        Go, actually

        1. @Icrarkie 11mo

          Maybe just need to use assembler?😁

Use J and K for navigation