Stack overflow
Simon Peyton-Jones
simonpj at microsoft.com
Fri Sep 13 03:02:14 EDT 2002
Yes, thanks. This is a known bug in 5.04.
What is interesting to me is how many people are using self-recursive
newtypes, with no intervening data types. That is, a type that would be
infinite if the newtype were a type synonym. At least four people have
independently reported the bug, so they are each making use of this
infinite-type stuff.
I'm sure there's a programming pearl in there... "Applications of
infinite types". If anyone wants to write it, I can probably dig out
the four instances.
Simon
| -----Original Message-----
| From: Alain Cremieux [mailto:alcremi at pobox.com]
| Sent: 12 September 2002 21:15
| To: glasgow-haskell-bugs at haskell.org
| Subject: Stack overflow
|
| Hi,
|
| The following code compiles OK with hugs (dec 2001) but produces a
loop
| & stack overflow with GHC 5.04
|
| data Ctx m a b = forall i. CBCC (a -> CUT m i -> CUT m i) (CUT m i)
| (Ctx m i b)
| newtype CUT m a = MkCut (forall b. Ctx m a b -> m b)
|
| promote :: Monad m => m a -> CUT m a
| promote m = MkCut (\ctx0 -> case ctx0 of
| CBCC c f ctx -> m >>= (\a
->
| let MkCut q = c a f
|
| in q ctx))
|
|
| when I replace the 'newtype' by 'data', it compiles again with GHC
|
| - the code is taken (and simplified) from "Deriving Backtracking Monad
| Transformers" from Ralph Hinze
| - compiled with -fglasgow-exts (of course), Linux and Windows versions
| of GHC and GHCI 5.04
|
| Alain
|
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
More information about the Glasgow-haskell-bugs
mailing list