From 822a70cf7a5971cc9d60239f98243bc1a07e12a5 Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 21 Oct 2010 15:01:52 +0000 Subject: change the TcM monad to continuation passing style. The old monad caused stack overflow for large search spaces --- src/runtime/haskell/PGF/Forest.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/runtime/haskell/PGF/Forest.hs') diff --git a/src/runtime/haskell/PGF/Forest.hs b/src/runtime/haskell/PGF/Forest.hs index 5d06f4e97..a4a9266f7 100644 --- a/src/runtime/haskell/PGF/Forest.hs +++ b/src/runtime/haskell/PGF/Forest.hs @@ -119,7 +119,7 @@ isLindefCId id getAbsTrees :: Forest -> PArg -> Maybe Type -> Maybe Int -> Either [(FId,TcError)] [Expr] getAbsTrees (Forest abs cnc forest root) arg@(PArg _ fid) ty dp = let (err,res) = runTcM abs (do e <- go Set.empty emptyScope (fmap (TTyp []) ty) arg - generateForForest (prove dp) e) fid IntMap.empty + generateForForest (prove dp) e) emptyMetaStore fid in if null res then Left (nub err) else Right (nubsort [e | (_,_,e) <- res]) @@ -205,7 +205,7 @@ instance Selector FId where splitSelector s = (s,s) select cat scope dp = do gens <- typeGenerators scope cat - TcM (\abstr s ms -> iter s ms gens) + TcM (\abstr k h -> iter k gens) where - iter s ms [] = Zero - iter s ms ((_,e,tty):fns) = Plus (Ok s ms (e,tty)) (iter s ms fns) + iter k [] ms s = id + iter k ((_,e,tty):fns) ms s = k (e,tty) ms s . iter k fns ms s -- cgit v1.2.3