Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib-tui/GHCup/Brick/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ withIOAction action = do
pure (updateList data' as)
Left err -> throwIO $ userError err

installWithOptions :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m)
installWithOptions :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m)
=> AdvancedInstall.InstallOptions
-> (Int, ListResult)
-> m (Either String ())
Expand Down Expand Up @@ -361,11 +361,11 @@ installWithOptions opts (_, ListResult {..}) = do
VLeft e -> pure $ Left $ prettyHFError e <> "\n"
<> "Also check the logs in ~/.ghcup/logs"

install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m)
install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m)
=> (Int, ListResult) -> m (Either String ())
install' = installWithOptions (AdvancedInstall.InstallOptions Nothing False Nothing Nothing False [] "install")

set' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m)
set' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m)
=> (Int, ListResult)
-> m (Either String ())
set' input@(_, ListResult {..}) = do
Expand Down Expand Up @@ -505,7 +505,7 @@ changelog' (_, ListResult {..}) = do
Right _ -> pure $ Right ()
Left e -> pure $ Left $ prettyHFError e

compileGHC :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m)
compileGHC :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m)
=> CompileGHC.CompileGHCOptions -> (Int, ListResult) -> m (Either String ())
compileGHC compopts (_, lr@ListResult{lTool = GHC, ..}) = do
appstate <- ask
Expand Down Expand Up @@ -603,7 +603,7 @@ compileGHC compopts (_, lr@ListResult{lTool = GHC, ..}) = do
compileGHC _ (_, ListResult{lTool = _}) = pure (Right ())


compileHLS :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m)
compileHLS :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m)
=> CompileHLS.CompileHLSOptions -> (Int, ListResult) -> m (Either String ())
compileHLS compopts (_, lr@ListResult{lTool = HLS, ..}) = do
appstate <- ask
Expand Down
3 changes: 1 addition & 2 deletions lib/GHCup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ rmGhcupDirs = do
------------------


getDebugInfo :: ( Alternative m
, MonadFail m
getDebugInfo :: ( MonadFail m
, MonadReader env m
, HasDirs env
, HasLog env
Expand Down
1 change: 0 additions & 1 deletion lib/GHCup/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ installGHCBin :: ( MonadFail m
, MonadResource m
, MonadIO m
, MonadUnliftIO m
, Alternative m
)
=> GHCTargetVersion -- ^ the version to install
-> InstallDir
Expand Down
14 changes: 7 additions & 7 deletions lib/GHCup/Platform.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import qualified Data.List as L


-- | Get the full platform request, consisting of architecture, distro, ...
platformRequest :: (MonadReader env m, Alternative m, MonadFail m, HasLog env, MonadCatch m, MonadIO m)
platformRequest :: (MonadReader env m, MonadFail m, HasLog env, MonadCatch m, MonadIO m)
=> Excepts
'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound]
m
Expand All @@ -96,7 +96,7 @@ getArchitecture = case arch of
what -> Left (NoCompatibleArch what)


getPlatform :: (Alternative m, MonadReader env m, HasLog env, MonadCatch m, MonadIO m, MonadFail m)
getPlatform :: (MonadReader env m, HasLog env, MonadCatch m, MonadIO m, MonadFail m)
=> Excepts
'[NoCompatiblePlatform, DistroNotFound]
m
Expand Down Expand Up @@ -136,15 +136,15 @@ getPlatform = do
Nothing


getLinuxDistro :: (Alternative m, MonadCatch m, MonadIO m, MonadFail m)
getLinuxDistro :: (MonadCatch m, MonadIO m, MonadFail m)
=> Excepts '[DistroNotFound] m (LinuxDistro, Maybe Versioning)
getLinuxDistro = do
-- TODO: don't do alternative on IO, because it hides bugs
(name, mid, ver) <- handleIO (\_ -> throwE DistroNotFound) $ lift $ asum
[ liftIO try_os_release
(name, mid, ver) <- join $ liftIO $ handleIO (\_ -> pure (throwE DistroNotFound)) $ fmap pure $ asum
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well yeah... the interesting part is getting rid of asum.

[ try_os_release
, try_lsb_release_cmd
, liftIO try_redhat_release
, liftIO try_debian_version
, try_redhat_release
, try_debian_version
]
let hasWord xs = let f t = any (\x -> match (regex x) (T.unpack t)) xs
in f name || maybe False f mid
Expand Down
Loading