In a recent answer to a style question, I wrote
main = untilM (isCorrect 42) (read `liftM` getLine)
and
isCorrect num guess
See The basics of applicative functors, put to practical work by Bryan O'Sullivan.