On 11/23/06, Conor McBride [EMAIL PROTECTED] wrote:
*Grr ifM (Just True) (Just 3) Nothing
Nothing
More care required!
Thank you. Now that you point this out I recall that I've made this
mistake in the past with (), I once wrote something like liftM2
(). I forget that the liftM* family
Jason Dagit wrote:
On 11/23/06, Conor McBride [EMAIL PROTECTED] wrote:
*Grr ifM (Just True) (Just 3) Nothing
Nothing
More care required!
Thank you. Now that you point this out I recall that I've made this
mistake in the past
You and me both. It's really insidious and can hide for weeks,
On 11/23/06, Dougal Stanton [EMAIL PROTECTED] wrote:
Is there some sort of equivalent of the if/then/else construct for use
in the IO monad? For instance the following can get quite tedious:
do bool - doesFileExist filename
if bool
then sth
else sth'
Is there a more compact way of
You can use 'when' or 'unless' from the module Control.Monad, but they
each have only one branch, see:
http://members.chello.nl/hjgtuyl/tourdemonad.html#unless
and
http://members.chello.nl/hjgtuyl/tourdemonad.html#when
You can create a monadic 'if' like this (in an interactive session):
Jason Dagit wrote:
On 11/23/06, Dougal Stanton [EMAIL PROTECTED] wrote:
Is there some sort of equivalent of the if/then/else construct for use
in the IO monad? For instance the following can get quite tedious:
do bool - doesFileExist filename
if bool
then sth
else sth'
Is there a
Dougal Stanton wrote:
Is there some sort of equivalent of the if/then/else construct for use
in the IO monad? For instance the following can get quite tedious:
do bool - doesFileExist filename
if bool
then sth
else sth'
Is there a more compact way of writing that?