diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-06-08 12:50:01 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-06-08 12:50:01 +0000 |
| commit | ef9174e35d62492a35b5e4ead908ba893c460815 (patch) | |
| tree | 497428a8d6aff7c7b2051e49b9b52a682d265276 /src/GF/Compile | |
| parent | 06acca1f679dc5e750a7f708800ec88272e577de (diff) | |
pattern matching optimization; trace of fun in compilation with -v
Diffstat (limited to 'src/GF/Compile')
| -rw-r--r-- | src/GF/Compile/Optimize.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/GF/Compile/Optimize.hs b/src/GF/Compile/Optimize.hs index 61e1615f0..a540ee715 100644 --- a/src/GF/Compile/Optimize.hs +++ b/src/GF/Compile/Optimize.hs @@ -34,6 +34,14 @@ import GF.Infra.Option import Control.Monad import Data.List +import Debug.Trace + + +-- conditional trace + +prtIf :: (Print a) => Bool -> a -> a +prtIf b t = if b then trace (" " ++ prt t) t else t + -- experimental evaluation, option to import oEval = iOpt "eval" @@ -113,10 +121,13 @@ evalResInfo oopts gr (c,info) = case info of evalCncInfo :: Options -> SourceGrammar -> Ident -> Ident -> (Ident,Info) -> Err (Ident,Info) -evalCncInfo opts gr cnc abs (c,info) = errIn ("optimizing" +++ prt c) $ case info of +evalCncInfo opts gr cnc abs (c,info) = do - CncCat ptyp pde ppr -> do + seq (prtIf (oElem beVerbose opts) c) $ return () + + errIn ("optimizing" +++ prt c) $ case info of + CncCat ptyp pde ppr -> do pde' <- case (ptyp,pde) of (Yes typ, Yes de) -> liftM yes $ pEval ([(strVar, typeStr)], typ) de |
