"equirecursive" type family leads to stack overflow in ghci
Trying to typecheck a term using a (silly) type family such that
T ~ Maybe T leads to a stack overflow (instead of a proper type error from reaching the max reduction depth, if this is to be an error at all).
Steps to reproduce
> :set -XTypeFamilies -XUndecidableInstances > type family T where T = Maybe T > :t Nothing @T Nothing @T*** Exception: stack overflow
(where the exception takes a few seconds to appear)
Compare that output to this variant that immediately produces a proper type error:
> :t Nothing @T :: T <interactive>:5:1 error: ...
Either a success (
Nothing @T has type
Maybe T without requiring any type conversion), or a type error instead of an internal exception.
- GHC version used: 8.10.1