
5 Nov
2009
5 Nov
'09
12:26 p.m.
So we could write:
myFunc = anotherFunc $ case of Left err -> print err Right msg -> putStrLn msg
A minor syntactical addition, a big win!
+1. While we're on the topic, what do people think of a related problem, case expressions over monadic values? I run into this often enough that it's a pain. I'd like to take result <- act1 case result of ... -> actN and drop the bind entirely to get case act1 of ... -> actN I know that there are many helper functions and constructs to make this sort of thing more readable, but sometimes a case expression is a good fit and the preceding bind just ends up being noisy. -- Jonathan Daugherty