
9 Sep
2008
9 Sep
'08
4:19 p.m.
Greetings, I just ran into the following situation in an IO do block: case msel of Just sel -> do toggleFretArea selectionRef sel widgetQueueDraw canvas Nothing -> return () except I omitted the last line. I expected the compiler to complain, but it silently compiled it, and I got a runtime exception when the program ran instead. Is this behaviour intentional? Can I get ghc to warn me about it anyway (something like -Wall)? Two more guiding questions: 1. What is a good idiom for "In this case do blah otherwise don't do anything"? 2. Is there a shorter way of writing a no-op in a do block than "return ()"? Thanks in advance! Rafal Kolanski.