# GHC: FunctionalDependencies, UndecidableInstances, and the type-checker

**URL:** <https://discourse.haskell.org/t/ghc-functionaldependencies-undecidableinstances-and-the-type-checker/10761>\
**Category:** Learn\
**Created:** [November 19, 2024, 6:19pm UTC](https://discourse.haskell.org/t/ghc-functionaldependencies-undecidableinstances-and-the-type-checker/10761 "2024-11-19T18:19:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [November 19, 2024, 7:02pm UTC](https://discourse.haskell.org/t/ghc-functionaldependencies-undecidableinstances-and-the-type-checker/10761/2 "2024-11-19T19:02:47Z")

</div>

> `Use -freduction-depth=0 to disable this check`

I’ve seen that _“hint”_ before:

> [@Reduction stack overflow](http://discourse.haskell.org/t/reduction-stack-overflow/10193/2):
>
> Some of the articles found during a brief websearch using ghc haskell "reduction stack" increase mention this option: Use -freduction-depth=0 to disable this check (any upper bound you could choose might fail unpredictably with minor updates to GHC, so disabling the check is recommended if you're sure that type checking should terminate) On my system: # ghci -freduction-depth=0 Foo.hs GHCi, version 9.8.2: https://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Foo ( Foo.hs,…

These _could_ be relevant:

> [@Reduction stack overflow](http://discourse.haskell.org/t/reduction-stack-overflow/10193/4):
>
> I think this program indeed yields an infinite loop in the constraint solver. The issue is that MonadWriter e (m e) has Monoid e as a superclass, so when GHC tries to solve the Applicative (m [Foo]) constraint arising from pure: It can use the quantified constraint to get MonadWriter [Foo] (m [Foo]) (and hence Monad (m [Foo]) and hence Applicative (m [Foo])), if only it can solve Monoid [Foo]. Now in order to produce Monoid [Foo], rather than using the global instance, it foolishly decides to …

> [@Reduction stack overflow](http://discourse.haskell.org/t/reduction-stack-overflow/10193/9):
>
> It means you would never be able to use foo, as instantiating it would require a solution to every constraint ever dreamed up by machine or man. A more effective workaround for this specific case would be foo :: (Monoid [Foo], forall e. Monoid e =\> MonadWriter e (m e)) =\> m [Foo] Int foo = pure 1 (You’ll get a compiler warning about a simplifiable class constraint—accurate, but you made me do this, GHC!)

---

_[View the full topic](https://discourse.haskell.org/t/ghc-functionaldependencies-undecidableinstances-and-the-type-checker/10761)._
