[Haskell-cafe] Question on a common pattern

Donn Cave donn at avvanta.com
Tue Mar 15 17:34:13 CET 2011


Quoth Tillmann Rendel <rendel at informatik.uni-marburg.de>,
...
> Where-clauses can only be used on equations, not on expressions or 
> statements, so you would need to float the where clause outwards:

So ... not to put too fine a point on it, but ... as useful as
function notation could be for the present purposes, you seem to
agree that because of syntax limits, "where" isn't an answer to
the problem.  Recalling that we were talking about a common pattern

   v <- fx
   case v of ...
   ... (where v never appears again)

Where a Haskell programmer's reflex seems to call for  fx >>= case ...,
or from the old thread mentioned earlier, a lambda with multiple
definitions -

   fx >>= \ Opt1 -> ...
            Opt2 -> ...

	Donn Cave, donn at avvanta.com



More information about the Haskell-Cafe mailing list