[Haskell-cafe] Cons of -XUndecidableInstances

Gábor Lehel illissius at gmail.com
Mon Jun 6 08:56:35 CEST 2011


On Mon, Jun 6, 2011 at 7:52 AM, Yitzchak Gale <gale at sefer.org> wrote:
> Scott Lawrence wrote:
>> More specifically, I have
>>
>>  class Model m a | m -> a where ...
>>  class Entropy d where ...
>>  instance (Model m a) => Entropy m where ...
>>
>> The first line requires MultiParamTypeClasses and
>> FunctionalDependencies... the third
>> requires UndecidableInstances...
>> Is this likely to cause a problem?
>
> Yes.
>
> 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.
>
> Your best bet is to step back and think again about
> the problem you are trying to solve. What is the
> best way to formulate the problem functionally?
> That will lead you in the right direction. Please
> feel free to share more details about what you are
> trying to do. We would be happy to help you work out
> some good directions.

Are you sure you weren't thinking of OverlappingInstances here? I
haven't seen as much scorn heaped upon Undecidable.

>
> Regards,
> Yitz
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Work is punishment for failing to procrastinate effectively.



More information about the Haskell-Cafe mailing list