<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<code>Hello!<br>
<br>
I tried Hoogle, but it didn't seem to have what I was after. I'm
looking for something like this:<br>
<br>
> maybeWhen :: Bool -> a -> Maybe a<br>
> maybeWhen cond =<br>
> if cond<br>
> then Just<br>
> else const Nothing<br>
<br>
Is there a builtin that has the above sort of behaviour? I suppose
it can even be generalised:<br>
<br>
> maybeWhen :: (MonadPlus m) => Bool -> a -> m a<br>
> maybeWhen cond =<br>
> if cond<br>
> then return<br>
> else const mzero<br>
<br>
Tacit<br>
</code>
</body>
</html>