Your first line is entirely natural.
The alternative doesn’t look right at all.
I am not aware of a more concise alternative to this general construction (assuming there are multiple case alternative, and that the work can’t be done with library functions).
Chris
From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of tsuraan
Sent: 14 March 2011 15:49
To: haskell-cafe@haskell.org
Subject: [Haskell-cafe] Question on a common pattern
In my code, I'm doing this quite a lot:
x <- someIO
case x of
Opt1 -> ...
Having a line for extracting the value from the IO (or STM) and then
acting on the value seems unnatural. Is there a more concise way to
do this? This code:
case someIO of
Opt1 -> ...
Doesn't work, but is there something like that, that is valid?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1204 / Virus Database: 1498/3506 - Release Date: 03/14/11