Hi,

Donn Cave wrote:
     someIO>>= f where
       f Opt1 = ...

I like this ... or, I would like it, if I could make it work!

I get "The last statement in a 'do' construct must be an expression",

Where-clauses can only be used on equations, not on expressions or statements, so you would need to float the where clause outwards:

foo = do someIO >>= f
  where f = ...

Or you can use let-in-expressions or let-statements to bind local values (or functions) in do-notation:

  do let f = ...
     result <- someIO >>= f

or

  do result <- let f = ... in
                 someIO >>= Op1 = ..

HTH, Tillmann

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to