Updates the Prompt module to use logInfo instead of putStrLn,

makes the prompt look prettier
This commit is contained in:
Arjun Kathuria 2022-06-28 19:45:17 +05:30
parent 0e1fd68d93
commit b8dac2d7cd

View File

@ -1,17 +1,28 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module GHCup.Prompts
(module GHCup.Types.Prompts,
getUserPromptResponse)
( module GHCup.Types.Prompts,
getUserPromptResponse,
)
where
import GHCup.Types.Prompts
import Control.Monad.Reader
import qualified Data.Text.IO as TIO
import Control.Monad.IO.Class (MonadIO, liftIO)
import GHCup.Prelude.Logger
import GHCup.Types.Optics
import GHCup.Types.Prompts
putPrompt :: MonadIO m => PromptQuestion -> m ()
putPrompt prompt = liftIO $ TIO.putStrLn prompt
putPrompt :: (HasLog env, MonadReader env m, MonadIO m)
=> PromptQuestion
-> m ()
putPrompt prompt = logInfo prompt
getUserPromptResponse :: (MonadIO m) => PromptQuestion -> m PromptResponse
getUserPromptResponse :: ( HasLog env
, MonadReader env m
, MonadIO m)
=> PromptQuestion
-> m PromptResponse
getUserPromptResponse prompt = do
putPrompt prompt
resp <- liftIO TIO.getLine