Removes redundant putPrompt
function from Prompts module.
This commit is contained in:
parent
0acccae523
commit
2bd5a8fe1a
@ -12,19 +12,16 @@ import Control.Monad.Reader
|
|||||||
import qualified Data.Text.IO as TIO
|
import qualified Data.Text.IO as TIO
|
||||||
import GHCup.Prelude.Logger
|
import GHCup.Prelude.Logger
|
||||||
import GHCup.Types.Optics
|
import GHCup.Types.Optics
|
||||||
|
import GHCup.Types (PromptQuestion, PromptResponse(..))
|
||||||
putPrompt :: (HasLog env, MonadReader env m, MonadIO m)
|
|
||||||
=> PromptQuestion
|
|
||||||
-> m ()
|
|
||||||
putPrompt = logInfo
|
|
||||||
|
|
||||||
getUserPromptResponse :: ( HasLog env
|
getUserPromptResponse :: ( HasLog env
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, MonadIO m)
|
, MonadIO m)
|
||||||
=> PromptQuestion
|
=> PromptQuestion
|
||||||
-> m PromptResponse
|
-> m PromptResponse
|
||||||
|
|
||||||
getUserPromptResponse prompt = do
|
getUserPromptResponse prompt = do
|
||||||
putPrompt prompt
|
logInfo prompt
|
||||||
resp <- liftIO TIO.getLine
|
resp <- liftIO TIO.getLine
|
||||||
if resp `elem` ["YES", "yes", "y", "Y"]
|
if resp `elem` ["YES", "yes", "y", "Y"]
|
||||||
then pure PromptYes
|
then pure PromptYes
|
||||||
|
Loading…
Reference in New Issue
Block a user