:kind! should adhere to -freduction-depth
Summary
:kind!
consumes gigabytes of memory for a while and then fails with *** Exception: stack overflow
(GHCi itself does not crash, as long as enough memory is available) if given a non-terminating type-level expression, while using such a type elsewhere will immediately result in ghc announcing that it has reached the limit of it's reduction stack (with size 200 by default, specified by -freduction-depth
). I can't be sure if this is intended, since -freduction-depth
doesn't appear to be documented in the user guide, but it's not something I would have expected.
Steps to reproduce
Type the following in GHCi:
:set -XTypeFamilies -XUndecidableInstances
type family F where F = F
:kind! F
Typing something like undefined :: F
works as expected, with an error message about having reached a reduction stack size of 201.
Expected behavior
I would expect to get the current error message from undefined :: F
for both undefined :: F
and :kind! F
.
Environment
- GHC version used:
8.6.5, 8.8.1, HEAD (8.9.0.20191001)
- Operating System:
Windows, nixos
- System Architecture:
x86_64