On Thu, Apr 29, 2004 at 06:27:32PM -0500, [EMAIL PROTECTED] wrote:
Hi,
While writing monad programs, I sometimes want to do a return as it is in
imperative program. i.e.,
do{return 1; return 2} is same as return 1
Is this possible at all?
Someone already proposed an Error monad, but I
On Thu, Apr 29, 2004 at 06:27:32PM -0500, [EMAIL PROTECTED] wrote:
While writing monad programs, I sometimes want to do a return as it is in
imperative program. i.e.,
do{return 1; return 2} is same as return 1
I know I can do
if cond then return 1 else (
...--subsequent actions
)
On 2004-04-29T18:27:32-0500, [EMAIL PROTECTED] wrote:
While writing monad programs, I sometimes want to do a return as it is in
imperative program. i.e.,
do{return 1; return 2} is same as return 1
Hello,
You can build an error monad transformer along the lines of the
Control.Monad.Error
Is this possible at all?
I don't think so, in the form that you suggest.
Ultimately, it all comes down to function applications, for which there is
no such bail out. Rather, I think something like this is required:
do
{ ...
; if cond then return 1
else do
(the rest)
], [EMAIL
PROTECTED]
g cc:
Subject: Re: [Haskell] return
Subject: Re: [Haskell] return?
AM
]
cc: [EMAIL PROTECTED]
04/30/2004 10:54 Subject: Re: [Haskell] return?
AM
John Meacham wrote:
you can make things somewhat better with this construct
foo = do
baz
if cond then return bar else do
bua
bam
Except that this is invalid according to the Haskell report. In note 1
in section 9.3 (Layout), the report explicitly states that A
Hi,
While writing monad programs, I sometimes want to do a return as it is in
imperative program. i.e.,
do{return 1; return 2} is same as return 1
This seems useful to me when I need to do something like
do
mwhen cond $ return 1
.. -- subsequent actions
I know I can do
if cond then