[Haskell-cafe] YAWQ (Yet Another Wash Question)

John Goerzen jgoerzen at complete.org
Thu Feb 24 12:33:40 EST 2005

On Thu, Feb 24, 2005 at 05:22:40PM +0000, Jules Bean wrote:
> On 24 Feb 2005, at 16:42, John Goerzen wrote:
> >... do if cond
> >          then x <- textInputField ...
> >          else ()
> >       ...
> >       submit ...
> >
> >Well, two problems there... first, the scope of the x doesn't reach to
> >the submit.  Second, there's a type issue.  So I thought maybe I could
> >figure out something like this:
> >
> Well, how could this possibly work (that is, how could 'x' be visible 
> at the point of submission)? If you go down the 'else' branch, what 
> value should x have?

I'm assuming I would have two different calls to submit, one for the
case where cond is true (that includes x), and one for the case where
cond is false (that omits it).

> Once you know what value x is supposed to have down the else branch 
> then you will be able to do something like:
> x <- if cond then textInputField ... else return ...

but I have to return something with the same type as textInputField, and
the only things with that type are other input fields.  I don't want
something else there.  I want nothing there.

More information about the Haskell-Cafe mailing list