[Haskell-cafe] Cons of -XUndecidableInstances

Yitzchak Gale gale at sefer.org
Mon Jun 6 09:13:42 CEST 2011


I wrote:
>> You almost never want to use UndecidableInstances
>> when writing practical programs in Haskell.
>> When GHC tells you that you need them, it almost
>> always means that your types are poorly designed,
>> usually due to influence from previous experience
>> with OOP.

Gábor Lehel wrote:
> Are you sure you weren't thinking of OverlappingInstances here? I
> haven't seen as much scorn heaped upon Undecidable.

Sorry, I didn't mean to come across as heaping
scorn on anything. :)

Having come from OOP myself, I know that at first you
don't realize the power and beauty of functional programming.
The vast majority of programming problems have a beautiful
solution without stepping outside of Haskell 98.

One of the symptoms of thinking about a problem in OOP style
rather than functionally is that you immediately find yourself
needing all of those kinds of type system extensions, which
just end up adding a huge amount of unneeded complexity.

Once you are fluent and comfortable with functional thinking,
you can learn about the many other tools and techniques that
are available and when it is best to apply them. I must admit
that even while designing and implementing large systems,
I haven't found myself needing anything involving either
UndecidableInstances or OverlappingInstances for several
years.

Regards,
Yitz



More information about the Haskell-Cafe mailing list