Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,869
    • Issues 4,869
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #18456
Closed
Open
Created Jul 15, 2020 by Xia Li-yao@LysxiaContributor

"equirecursive" type family leads to stack overflow in ghci

Summary

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:
...

Expected behavior

Either a success (Nothing @T has type Maybe T without requiring any type conversion), or a type error instead of an internal exception.

Environment

  • GHC version used: 8.10.1
Edited Jul 17, 2020 by Xia Li-yao
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking