From c60eac3f0a18fc438df085255b292a04f3518e4a Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Thu, 20 Jun 2019 15:06:50 +0800 Subject: [PATCH] Pointfree life --- src/Prompts.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Prompts.hs b/src/Prompts.hs index 240c1cf..72530d6 100644 --- a/src/Prompts.hs +++ b/src/Prompts.hs @@ -25,8 +25,9 @@ cannotBeEmpty xs = case null xs of prompt :: Text -> IO a -> (a -> Either Text b) -> IO b prompt xs readerThing validate = do - hSetBuffering stdout $ BlockBuffering $ Just 1; + hSetBuffering stdout $ BlockBuffering $ Just 1 hSetBuffering stdin NoBuffering + putStr xs response <- readerThing case validate response of @@ -35,7 +36,7 @@ prompt xs readerThing validate = do subPrompt :: IO a -> IO b -> (a -> Bool) -> IO (Maybe (a, b)) subPrompt p1 p2 showNext = do - p1 >>= (\x -> if showNext x then p2 >>= (\y -> return $ Just (x,y)) else return Nothing) + p1 >>= (\x -> if showNext x then p2 >>= (return . Just . (x, )) else return Nothing) textPrompt :: Text -> IO Text textPrompt xs = prompt xs getLine Right -- 2.11.0