Skip to content

type error causes type checker stack overflow

The following code causes

*** Exception: stack overflow

during type checking. I've tried to whittle the test case down, this may not be minimal. The (Ord a) instances and the unused vertexID member of the datatype seem to be necessary, otherwise the infinite type is correctly caught. Does not occur under 6.6.1

module GHCBug(
  MeshVertex(..)
  ) where

data (Ord a) => MeshVertex a b = MeshVertex {
  vertexID         :: a,
  vertexChildren   :: [a]
  } deriving (Show)

split :: (Ord a)   =>
  a                ->
  [MeshVertex a b] ->
  [MeshVertex a b]
split a m = let
    av      = head m
    newVTs  = preSplit a m
    av'     = av { vertexChildren = newVTs }
    newMVs  = av' : m
    newMesh = newMVs
  in newMesh

preSplit :: (Ord a) =>
  a                 ->
  [MeshVertex a b]  ->
  [MeshVertex a b]
preSplit a m = preSplit a $ split a m
Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system MacOS X
Architecture x86
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information