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 OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module GHCup.Prompts module GHCup.Prompts
(module GHCup.Types.Prompts, ( module GHCup.Types.Prompts,
getUserPromptResponse) getUserPromptResponse,
)
where where
import GHCup.Types.Prompts import Control.Monad.Reader
import qualified Data.Text.IO as TIO 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 :: (HasLog env, MonadReader env m, MonadIO m)
putPrompt prompt = liftIO $ TIO.putStrLn prompt => 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 getUserPromptResponse prompt = do
putPrompt prompt putPrompt prompt
resp <- liftIO TIO.getLine resp <- liftIO TIO.getLine