[Haskell-cafe] YAWQ (Yet Another Wash Question)
Mike Gunter
m at ryangunter.com
Thu Feb 24 17:23:40 EST 2005
The most natural seeming thing is one permutation you don't mention:
do x <- if cond then Just $ textInputField ...
else return Nothing
...
... submit ... -- perhaps: maybe (return ()) submit x
-- or submit (fromMaybe <something> x)
. Does that do what you want?
mike
John Goerzen <jgoerzen at complete.org> writes:
> Thanks for everyone that's helped me out with my Wash questions. I have
> one more.
>
> I have a textInputField that I only want to display on a form in certain
> cituations. I can't figure out how to make this work. For instance:
>
> ... 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:
>
> ... do x <- if cond
> then textInputField ...
> else ()
>
> still stuck with the typing problem.
>
> So I thought maybe something like this...
>
> ... do let x = if cond
> then Just $ textInputField ...
> else Nothing
>
> Though I suspect this won't work either, since the textInputField won't
> actually be processed at the right place in the program.
>
> I then thought maybe I could kludge by this with a hidden field, but I
> can't find one of those, either.
>
> Ideas, anyone?
>
> Thanks,
> John
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list