<div dir="ltr">Please, I'm trying to do some user user input validation, but it looks like my approach is not correct. Here is my code:<div><br></div><div><div>textInput :: IO ()</div><div>textInput</div><div><span class="" style="white-space:pre">        </span>| dataIn == "bye" = return () </div>
<div><span class="" style="white-space:pre">        </span>| otherwise = textInput</div><div><span class="" style="white-space:pre">        </span>where dataIn <- getLine</div></div><div><br></div><div style>the idea is that when user inputs "bye" the program should end/return. Problem is that I'm getting 'parse error on input `<-'' error. How can I achieve it?</div>
<div style><br></div><div style>Another question I have is: how can I have more actions in guard, when the condition is valid. Something like (write on IO + return if dataIn == "bye):</div><div style><br></div><div style>
<div><div>textInput :: IO ()</div><div>textInput</div><div><span class="" style="white-space:pre">        </span><b>| dataIn == "bye" = (puStrLn "quitting", return () ) -- </b></div><div><span class="" style="white-space:pre">        </span>| otherwise = textInput</div>
<div><span class="" style="white-space:pre">        </span>where dataIn <- getLine</div></div><div><br></div><div style>Millions of thanks for any kind of input..</div><div style><br></div><div style>Cheers,</div><div style>Miro</div>
</div></div>