Stack overflow
Alain Cremieux
alcremi at pobox.com
Thu Sep 12 16:14:40 EDT 2002
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
More information about the Glasgow-haskell-bugs
mailing list