summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-01-28 16:12:56 +0000
committerhallgren <hallgren@chalmers.se>2013-01-28 16:12:56 +0000
commit713e883ad7816f0bb0e3cb7f3cb8fc2a636c805b (patch)
tree85f332dec1a89a3f246da80b036bbd4a171bd51f /src/compiler/GF/Compile.hs
parent3360cc904cf80f02884bf07bd0bfb6ff72d77974 (diff)
Better error message for Predef.error
+ Instead of "Internal error in ...", you now get a proper error message with a source location and a function name. + Also added some missing error value propagation in the partial evaluator. + Also some other minor cleanup and error handling fixes.
Diffstat (limited to 'src/compiler/GF/Compile.hs')
-rw-r--r--src/compiler/GF/Compile.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs
index b8db1e1a9..9b71c0f39 100644
--- a/src/compiler/GF/Compile.hs
+++ b/src/compiler/GF/Compile.hs
@@ -30,7 +30,7 @@ import System.IO
import System.Directory
import System.FilePath
import qualified Data.Map as Map
-import qualified Data.Set as Set
+--import qualified Data.Set as Set
import Data.List(nub)
import Data.Maybe (isNothing)
import qualified Data.ByteString.Char8 as BS
@@ -55,7 +55,7 @@ link opts cnc gr = do
let isv = (verbAtLeast opts Normal)
putPointE Normal opts "linking ... " $ do
let abs = err (const cnc) id $ abstractOfConcrete gr cnc
- pgf <- ioeIO (mkCanon2pgf opts gr abs)
+ pgf <- mkCanon2pgf opts gr abs
probs <- ioeIO (maybe (return . defaultProbabilities) readProbabilitiesFromFile (flag optProbsFile opts) pgf)
ioeIO $ when (verbAtLeast opts Normal) $ putStrFlush "OK"
return $ setProbabilities probs
@@ -196,7 +196,7 @@ compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do
refreshModule (k,gr) mo3
mo4 <- runPass2 id Optimize "optimizing" $ optimizeModule opts gr mo3r
mo5 <- if isModCnc (snd mo4) && flag optPMCFG opts
- then runPass2' "generating PMCFG" $ generatePMCFG opts gr mo4
+ then runPass2' "generating PMCFG" $ generatePMCFG opts gr mb_gfFile mo4
else runPass2' "" $ return mo4
generateGFO k' mo5
@@ -215,9 +215,10 @@ compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do
putpp s = if null s then id else putPointE Verbose opts (" "++s++" ")
idump pass = intermOut opts (Dump pass) . ppModule Internal
+ -- * Impedance matching
runPass = runPass' fst fst snd (ioeErr . runCheck)
runPass2 = runPass2e ioeErr
- runPass2' = runPass2e ioeIO id Canon
+ runPass2' = runPass2e id id Canon
runPass2e lift f = runPass' id f (const "") lift
runPass' ret dump warn lift pass pp m =