Only run unsafeInterleaveIO when necessary
This commit is contained in:
parent
bf74d1e828
commit
7e14fd4a08
@ -1244,8 +1244,12 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
-- Getting download and platform info --
|
-- Getting download and platform info --
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
|
-- for some commands we want lazy loading
|
||||||
|
let wrapIO = case optCommand of
|
||||||
|
Whereis _ _ -> unsafeInterleaveIO
|
||||||
|
_ -> id
|
||||||
|
|
||||||
pfreq <- unsafeInterleaveIO $ (
|
pfreq <- wrapIO $ (
|
||||||
runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest
|
runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest
|
||||||
) >>= \case
|
) >>= \case
|
||||||
VRight r -> pure r
|
VRight r -> pure r
|
||||||
@ -1254,7 +1258,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
($(logError) $ T.pack $ prettyShow e)
|
($(logError) $ T.pack $ prettyShow e)
|
||||||
exitWith (ExitFailure 2)
|
exitWith (ExitFailure 2)
|
||||||
|
|
||||||
ghcupInfo <- unsafeInterleaveIO $
|
ghcupInfo <- wrapIO $
|
||||||
( runLogger
|
( runLogger
|
||||||
. runE @'[JSONError , DownloadFailed, FileDoesNotExistError]
|
. runE @'[JSONError , DownloadFailed, FileDoesNotExistError]
|
||||||
$ liftE
|
$ liftE
|
||||||
|
Loading…
Reference in New Issue
Block a user