Don't use fromJust
This commit is contained in:
parent
56cc237e26
commit
506cf18885
@ -99,7 +99,7 @@ import Control.Monad.Error (Error(..))
|
|||||||
#endif
|
#endif
|
||||||
import Control.Monad.Journal.Class
|
import Control.Monad.Journal.Class
|
||||||
|
|
||||||
import Data.Maybe (fromJust, isJust)
|
import Data.Maybe (isJust)
|
||||||
import Data.IORef (IORef, readIORef, writeIORef, newIORef)
|
import Data.IORef (IORef, readIORef, writeIORef, newIORef)
|
||||||
import System.Directory (getCurrentDirectory)
|
import System.Directory (getCurrentDirectory)
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ instance MonadIO m => MonadIO (GhcModT m) where
|
|||||||
|
|
||||||
where
|
where
|
||||||
fromEx :: Exception e => SomeException -> e
|
fromEx :: Exception e => SomeException -> e
|
||||||
fromEx = fromJust . fromException
|
fromEx se = let Just e = fromException se in e
|
||||||
isIOError se =
|
isIOError se =
|
||||||
case fromException se of
|
case fromException se of
|
||||||
Just (_ :: IOError) -> True
|
Just (_ :: IOError) -> True
|
||||||
@ -221,7 +221,8 @@ initializeFlagsWithCradle opt c
|
|||||||
cabal = isJust mCabalFile
|
cabal = isJust mCabalFile
|
||||||
ghcopts = ghcUserOptions opt
|
ghcopts = ghcUserOptions opt
|
||||||
withCabal = do
|
withCabal = do
|
||||||
pkgDesc <- parseCabalFile c $ fromJust mCabalFile
|
let Just cabalFile = mCabalFile
|
||||||
|
pkgDesc <- parseCabalFile c cabalFile
|
||||||
compOpts <- getCompilerOptions ghcopts c pkgDesc
|
compOpts <- getCompilerOptions ghcopts c pkgDesc
|
||||||
initSession CabalPkg opt compOpts
|
initSession CabalPkg opt compOpts
|
||||||
withSandbox = initSession SingleFile opt compOpts
|
withSandbox = initSession SingleFile opt compOpts
|
||||||
|
@ -35,7 +35,8 @@ spec = do
|
|||||||
cwd <- getCurrentDirectory
|
cwd <- getCurrentDirectory
|
||||||
withDirectory "test/data/subdir1/subdir2" $ \dir -> do
|
withDirectory "test/data/subdir1/subdir2" $ \dir -> do
|
||||||
crdl <- findCradle
|
crdl <- findCradle
|
||||||
pkgDesc <- runD $ parseCabalFile crdl $ fromJust $ cradleCabalFile crdl
|
let cabalFile = cradleCabalFile crdl
|
||||||
|
pkgDesc <- runD $ parseCabalFile crdl cabalFile
|
||||||
res <- runD $ getCompilerOptions [] crdl pkgDesc
|
res <- runD $ getCompilerOptions [] crdl pkgDesc
|
||||||
let res' = res {
|
let res' = res {
|
||||||
ghcOptions = ghcOptions res
|
ghcOptions = ghcOptions res
|
||||||
|
Loading…
Reference in New Issue
Block a user