[Haskell-cafe] Cons of -XUndecidableInstances

Brandon Allbery allbery.b at gmail.com
Mon Jun 6 06:50:48 CEST 2011


On Mon, Jun 6, 2011 at 00:26, Scott Lawrence <bytbox at gmail.com> wrote:
> According to the haskell-prime wiki[1], -XUndecidableInstances removes
> checks on the form of instance declaration, and just impose a depth
> limit to ensure termination (of compilation, I assume?). The listed
> Con is that this removes the clear boundary between legal and illegal
> programs, and behaviour may be implementation-dependent as the edge of
> that boundary is reached. How can I tell when I'm nearing that
> boundary? (And where are the sorts of things GHC does with types

You can't; that's more or less the definition of that limit.  The
informal definition of -XUndecidableInstances is "allow things which
could lead to the typechecker trying to solve the Halting Problem".
So yes, it's fairly conservative without that option because the only
types allowed are those that it can prove ahead of time will terminate
(a much smaller set than that of types that will terminate).



More information about the Haskell-Cafe mailing list