
15 Mar
2011
15 Mar
'11
11:11 a.m.
Quoth Achim Schneider
I use
someIO >>= f where f Opt1 = ...
If it's a common pattern, you can even do
opts f _ _ (Opt1 x) = f x opts _ g _ (Opt2 x) = g x opts _ _ h (Opt3 x) = h x
. Functions are easier to mess around with than case expressions.
I like this ... or, I would like it, if I could make it work! I get "The last statement in a 'do' construct must be an expression", if I don't drag the `where' clause down to the end of the `do' block around `someIO', which of course is what we're trying to avoid with the case expression. I must have missed a trick with the layout? Donn Cave, donn@avvanta.com