[Haskell-cafe] Conditionals and case expressions in do blocks
Ferenc Wagner
wferi at niif.hu
Thu Jan 27 10:55:42 CET 2011
aditya siram <aditya.siram at gmail.com> writes:
> Yep, I do this often and it's pretty nasty. It's especially
> inconvenient that you don't have access to computations before the if,
> for example:
> do
> x <- something
> y <- something-else
> case y of
> Foo a -> do
> .... <--- I want access to 'x' here
> Bar b -> ...
I don't see the problem, this works for me:
main = do
x <- return "foo"
y <- return "bar"
case y of
'b':_ -> putStrLn x
--
Regards,
Feri.
More information about the Haskell-Cafe
mailing list