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
  • #4358
Closed
Open
Created Oct 01, 2010 by patrick_premont@trac-patrick_premont

infinite loop on unification with a type family context

The following throws ghc (and ghci) in a loop (ghc-7.0.0.20100925 for i386-unknown-mingw32) and it eventually aborts with "ghc.exe: out of memory".

> {-# LANGUAGE TypeFamilies, Rank2Types, FlexibleContexts #-}

> type family T a

> t2 :: forall a. ((T a ~ a) => a) -> a
> t2 = t
  
> t :: forall a. ((T a ~ a) => a) -> a
> t = undefined

Using ghc 6.12.1 we do not get a loop, but a puzzling error:

typeBug.lhs:9:7:

Couldn't match expected type (T a ~ a) => a' against inferred type (T a ~ a) => a'

Expected type: (T a ~ a) => a

Inferred type: (T a ~ a) => a

In the expression: t

In the definition of `t2': t2 = t

I presume that the non-injectivity of type family T triggers the problem however the following produces no errors in either version of the compiler.

> ok2 :: forall a. T a -> a
> ok2 = ok
  
> ok :: forall a. T a -> a
> ok = undefined
Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking