[Haskell-cafe] can't WashNGo (abstract tables)

Ferenc Wagner wferi at tba.elte.hu
Fri Jul 14 13:23:35 EDT 2006


trying to put WashNGo-2.9 to a nontrivial prototyping job
gave some very compelling results so far, but also got me
stumped on occasions.  I'd be grateful for some guidance on
the following points, concerning abstract tables mainly.

* selectionDisplay: looks like displayFun (fourth arg)
  mustn't fail for null arguments, as it's invoked with them
  after leaving the page it appears on.  An error or a
  feature?  Is it documented?

* trying to get around the "Strings only" restriction of
  AT's I threw in some show-read pairs, but got the
  impression that the channel is not Char-clean:
  Base64.encode . UTF8.encode helped.  What's the spec?

* should a click on an AT radio button result in submission
  of the form?  It does not, which is OK with me.  But the
  following code fails in a rather strange way:

> data Record = P String Person | R String Role | Unknown String deriving (Read,Show)
> unAtSafe :: String -> Record
> unAtSafe = read . fst . UTF8.decode . Base64.decode
> edit sg = case record of
>           P dn p    -> editPerson dn p
>           R dn r    -> editRole dn r
>           Unknown s -> standardQuery "No dice" $ CGI.div $ -- provokes error in AbstractSelector.hs:115
>                        do p $ text s
>                           goBack
>     where record = unAtSafe $ head $ unAR $ value sg 
> editPerson :: String -> Person -> CGI ()
> editPerson dn p =
>     standardQuery "Edit person" $ CGI.div $
>     do inputs <- personTable p
>        actionPar "Modify" (createPerson dn) inputs

  In this case Person and Role contain String fields only.
  The abstract table contains Records, and the above
  function 'edit' dispatches on the type of the selected
  Record.  The first two cases work, the Unknown case trips
  on an 'error' in the WashNGo code as indicated.  It's in
  the valueSelectionGroup function, if selectionValue is
  Nothing.  How could I fix this?

* Lastly, how can I go back some queries?  goBack above is
  basically a 'submit0 (return ())' which continues the main
  'forever' loop.  But what if I need to go back in the
  middle of the current loop, as if the user pressed Back
  several times?

More information about the Haskell-Cafe mailing list