If its monadic code then use Control.Monad.when.<br><br>If its pure code then omitting the 'else' clause makes no sense what-so-ever; to omit the else you must know the boolean is always true so why have the if? See the "Common Misunderstandings" [1] page I put together in response to seeing one too many people trip over exactly this issue.<br>
<br>Thomas<br><br>[1] <a href="http://haskell.org/haskellwiki/Common_Misunderstandings">http://haskell.org/haskellwiki/Common_Misunderstandings</a><br><br><div class="gmail_quote">On Wed, Oct 21, 2009 at 5:43 PM, michael rice <span dir="ltr"><<a href="mailto:nowgate@yahoo.com">nowgate@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
It looks like both the THEN and the ELSE in an IF expression must each have an expression. What's a graceful way to do nothing in either or both slots, kind of like the Fortran CONTINUE statement.<br><br> --mr<br><br>
================<br><br>[michael@localhost ~]$ ghci<br>GHCi, version 6.10.3: <a href="http://www.haskell.org/ghc/" target="_blank">http://www.haskell.org/ghc/</a> :? for help<br>Loading package ghc-prim ... linking ... done.<br>
Loading package integer ... linking ... done.<br>Loading package base ... linking ... done.<br>Prelude> if (1==1) then else<br><br><interactive>:1:15: parse error on input `else'<br>Prelude> if (1==1) then True else<br>
<br><interactive>:1:24: parse error (possibly incorrect indentation)<br>Prelude> if (1==1) then True else False<br>True<br>Prelude> <br><br></td></tr></tbody></table><br>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>