
31 Aug
2013
31 Aug
'13
2:23 p.m.
On Sat, Aug 31, 2013 at 08:05:26PM +0200, Nathan Hüsken wrote:
Hey,
Is it somehow possible to return "early" in a do block of the IO monad? The eqivalent do in C:
void doBlock() { if (some preCondition) { return; } ... }
???
Nope. But you can say do ... when (not (some condition)) $ do the rest of the stuff You can even indent "the rest of the stuff" directly under the 'when' if you like, though IMO that may be a bit confusing. -Brent