[Haskell-cafe] Question on a common pattern
Chris Dornan
chris at chrisdornan.com
Mon Mar 14 17:12:06 CET 2011
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 at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of tsuraan
Sent: 14 March 2011 15:49
To: haskell-cafe at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110314/21080e4c/attachment.htm>
More information about the Haskell-Cafe
mailing list