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:[EMAIL PROTECTED]]
| Sent: 12 September 2002 21:15
| To: [EMAIL PROTECTED]
| 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
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to