Commit 0f66260b authored by Clemens Fruhwirth's avatar Clemens Fruhwirth

Replace couple of fromJust with expectJust

parent 178eeaa8
......@@ -52,7 +52,7 @@ import StaticFlags
import Linker
import Util
import NameSet
import Maybes ( orElse )
import Maybes ( orElse, expectJust )
import FastString
import Encoding
import MonadUtils ( liftIO )
......@@ -2247,7 +2247,7 @@ listModuleLine modl line = do
case this of
[] -> panic "listModuleLine"
summ:_ -> do
let filename = fromJust (ml_hs_file (GHC.ms_location summ))
let filename = expectJust "listModuleLine" (ml_hs_file (GHC.ms_location summ))
loc = GHC.mkSrcLoc (mkFastString (filename)) line 0
io $ listAround (GHC.srcLocSpan loc) False
......
......@@ -78,7 +78,6 @@ import System.Directory
import Distribution.Package hiding (depends, PackageId)
import Exception
import Data.Maybe
\end{code}
......@@ -638,8 +637,7 @@ getLinkDeps hsc_env hpt _ maybe_normal_osuf span mods
get_linkable maybe_normal_osuf mod_name -- A home-package module
| Just mod_info <- lookupUFM hpt mod_name
= ASSERT(isJust (hm_linkable mod_info))
adjust_linkable (fromJust (hm_linkable mod_info))
= adjust_linkable (Maybes.expectJust "getLinkDeps" (hm_linkable mod_info))
| otherwise
= do -- It's not in the HPT because we are in one shot mode,
-- so use the Finder to get a ModLocation...
......
......@@ -21,7 +21,7 @@ module PackageConfig (
#include "HsVersions.h"
import Data.Maybe
import Maybes
import Module
import Distribution.InstalledPackageInfo
import Distribution.ModuleName
......@@ -80,7 +80,7 @@ packageConfigToInstalledPackageInfo
pkgconf{ exposedModules = map convert e,
hiddenModules = map convert h }
where convert :: Module.ModuleName -> Distribution.ModuleName.ModuleName
convert = fromJust . simpleParse . moduleNameString
convert = (expectJust "packageConfigToInstalledPackageInfo") . simpleParse . moduleNameString
-- | Turn an 'InstalledPackageInfo', which contains Cabal 'Distribution.ModuleName.ModuleName's
-- into a GHC specific 'PackageConfig' which contains GHC 'Module.ModuleName's
......
......@@ -20,7 +20,7 @@ import LazyUniqFM
import FiniteMap
import FastString
import Maybe
import Maybes
import Monad
\end{code}
......@@ -117,8 +117,8 @@ checkFamInstConsistency famInstMods directlyImpMods
-- already loaded in the EPS or they are in the HPT.
--
check modInstsEnv (ModulePair m1 m2)
= let { instEnv1 = fromJust . lookupModuleEnv modInstsEnv $ m1
; instEnv2 = fromJust . lookupModuleEnv modInstsEnv $ m2
= let { instEnv1 = (expectJust "checkFamInstConsistency") . lookupModuleEnv modInstsEnv $ m1
; instEnv2 = (expectJust "checkFamInstConsistency") . lookupModuleEnv modInstsEnv $ m2
; insts1 = famInstEnvElts instEnv1
}
in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment