Was that my claim?
It certainly doesn’t prevent all bugs. The refrain I generally see (which I did not write here) is “if a Haskell program compiles, it probably works" Note that “probably” doesn’t mean “always” and “works” isn’t a synonym for “is absent of any and all bugs”.
Yes algebraic data types and compiler options that force you to handle all cases are a big part of it. Additionally, verifying correct record field names, needed type class instances exist, a total absence of nulls (and the forced handling of Nothing cases).
It’s also the type inference, I want the above features and I don’t want to write out type signatures before I’m ready.
The dependently typed stuff (e.g. Idris) is compelling but you do lose the inference.
I've noticed this claim, that Haskell's type system prevents all bugs, eg at:
https://www.costarastrology.com/why-haskell/
And when they say it prevents all bugs and has no illegal states they seem to mostly mean it has ADTs.
But who is keeping me from having bugs in my numeric code? Not Haskell, making you type "fromIntegral" doesn't prevent bugs. Idris or Ada, maybe.