projects
/
xyz.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7cda95f
)
Pointfree life
author
Cameron Ball
<cameron@moodle.com>
Thu, 20 Jun 2019 07:06:50 +0000
(15:06 +0800)
committer
Cameron Ball
<cameron@moodle.com>
Thu, 20 Jun 2019 07:06:50 +0000
(15:06 +0800)
src/Prompts.hs
patch
|
blob
|
history
diff --git
a/src/Prompts.hs
b/src/Prompts.hs
index
240c1cf
..
72530d6
100644
(file)
--- 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
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
hSetBuffering stdin NoBuffering
+
putStr xs
response <- readerThing
case validate response of
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
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
textPrompt :: Text -> IO Text
textPrompt xs = prompt xs getLine Right