diff options
author | Clemens Fruhwirth <clemens@endorphin.org> | 2008-11-07 16:07:35 +0000 |
---|---|---|
committer | Clemens Fruhwirth <clemens@endorphin.org> | 2008-11-07 16:07:35 +0000 |
commit | 0f66260b5afc88accb6af6a09b20c3a4de51c39a (patch) | |
tree | 4d00ee838e63b34bca91ddb81f9434ed88d6778a /compiler | |
parent | 178eeaa814ab8323a54024e4bb45b4629b7828c8 (diff) | |
download | haskell-0f66260b5afc88accb6af6a09b20c3a4de51c39a.tar.gz |
Replace couple of fromJust with expectJust
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ghci/InteractiveUI.hs | 4 | ||||
-rw-r--r-- | compiler/ghci/Linker.lhs | 4 | ||||
-rw-r--r-- | compiler/main/PackageConfig.hs | 4 | ||||
-rw-r--r-- | compiler/typecheck/FamInst.lhs | 6 |
4 files changed, 8 insertions, 10 deletions
diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 4fdf949233..933a98e444 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -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 diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 8ad2be8d99..0de30af0af 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -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... diff --git a/compiler/main/PackageConfig.hs b/compiler/main/PackageConfig.hs index 1602429f64..a3fd027bb6 100644 --- a/compiler/main/PackageConfig.hs +++ b/compiler/main/PackageConfig.hs @@ -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 diff --git a/compiler/typecheck/FamInst.lhs b/compiler/typecheck/FamInst.lhs index 67c526d657..5f4b2a3f92 100644 --- a/compiler/typecheck/FamInst.lhs +++ b/compiler/typecheck/FamInst.lhs @@ -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 |