#2202: type error causes type checker stack overflow
-----------------------+----------------------------------------------------
Reporter: chiral | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (Type checker)
Version: 6.8.2 | Severity: normal
Keywords: | Testcase:
Architecture: x86 | Os: MacOS X
-----------------------+----------------------------------------------------
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
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2202>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs