* Günther Schmidt gue.schm...@web.de [2010-06-11 01:22:27+0200]
there is nothing wrong with ifs as such except the won't actually
exit a long piece of code, the computation will continue, just in a
useless way.
Can you clarify?
--
Roman I. Cheplyaka :: http://ro-che.info/
Don't let school
On 11 June 2010 10:12, Roman Cheplyaka r...@ro-che.info wrote:
* Günther Schmidt gue.schm...@web.de [2010-06-11 01:22:27+0200]
there is nothing wrong with ifs as such except the won't actually
exit a long piece of code, the computation will continue, just in a
useless way.
Can you clarify?
Hello Christopher,
Friday, June 11, 2010, 4:06:05 PM, you wrote:
do if x
then return ()
else do bar; continueComputation
i format it this way:
if x then return () else do
bar
continueComputation
--
Best regards,
Bulat
On 11 June 2010 14:27, Bulat Ziganshin bulat.zigans...@gmail.com wrote:
i format it this way:
if x then return () else do
bar
continueComputation
That's a nice way of formatting! God bless optional formatting! I like
this problem-specific indentation. Another is:
if xthen foo
else
Hello Christopher,
Friday, June 11, 2010, 4:35:00 PM, you wrote:
if xthen foo
else if y then bar
else if z then mu
else zot
case () of
_ | x - foo
| y - bar
| otherwise - zor
it's usually considered as haskell way of doing this
--
Best regards,
Bulat
On 11 June 2010 14:40, Bulat Ziganshin bulat.zigans...@gmail.com wrote:
if x then foo
else if y then bar
else if z then mu
else zot
case () of
_ | x - foo
| y - bar
| otherwise - zor
it's usually considered as haskell way of doing this
The example is merely to
Hi everyone,
I'm about to write a rather lengthy piece of IO code. Depending on the
results of some of the IO actions I'd like the computation to stop right
there and then.
Now I know in general how to write this but I'm wondering if this is one
of those occasions where I should make use of
Yeah I don't see why not. The ContT monad should work great.
Also, depending on what you're doing, the ErrorT monad might do what you
want as well.
- Job
2010/6/10 Günther Schmidt gue.schm...@web.de
Hi everyone,
I'm about to write a rather lengthy piece of IO code. Depending on the
results
I have a general question about this kind of approach. Tutorials on
continuations in Haskell always come with a warning about not using it
unless you have to because it makes code unreadable and
unmaintainable. Is this true in your opinion?
-deech
On 6/10/10, Job Vranish job.vran...@gmail.com
Günther,
This is definitely one way to do it. If you want to be able to quit the
IO action in the middle of a lengthy computation, that is one way that I,
personally, find very straightfoward. You can find an example of this in my
Advgame package on Hackage, which uses this method to quit
I would not use the continuation monad just for early exit. Sounds
like the error monad to me.
2010/6/10 Günther Schmidt gue.schm...@web.de:
Hi everyone,
I'm about to write a rather lengthy piece of IO code. Depending on the
results of some of the IO actions I'd like the computation to stop
2010/6/10 Günther Schmidt gue.schm...@web.de:
Hi everyone,
I'm about to write a rather lengthy piece of IO code. Depending on the
results of some of the IO actions I'd like the computation to stop right
there and then.
What's wrong with a mere if/else condition?
foo = do
bar
x - mu
Actually, on second thought, Lennart is probably right. Continuations are
probably overkill for this situation.
Since not wanting to continue is probably an 'erroneous condition,' you may
as well use Error.
Cheers,
- Tim
2010/6/10 Lennart Augustsson lenn...@augustsson.net
I would not use the
Hi Christopher,
there is nothing wrong with ifs as such except the won't actually exit a
long piece of code, the computation will continue, just in a useless way.
Primarily for every if I need two forks, so at every if the branches
double.
I have written the previous code with ifs and it's
Lennart Augustsson wrote:
I would not use the continuation monad just for early exit. Sounds
like the error monad to me.
I.e., the Either/ErrorT monad. But the mtl/transformers packages
have an orphan instance for Either that requires the
exit type to be an instance of the Error class. If that
Or... one could just use the exceptions that are already built into
the IO monad...
2010/6/10 Yitzchak Gale g...@sefer.org:
Lennart Augustsson wrote:
I would not use the continuation monad just for early exit. Sounds
like the error monad to me.
I.e., the Either/ErrorT monad. But the
On Thu, Jun 10, 2010 at 8:45 PM, Derek Elkins derek.a.elk...@gmail.comwrote:
Or... one could just use the exceptions that are already built into
the IO monad...
It feels to me like this discussion has a lot of speculation in it. I would
like to see concrete examples of the code and the
17 matches
Mail list logo