[Haskell-cafe] The Good, the Bad and the GUI

Alberto G. Corona agocorona at gmail.com
Tue Aug 12 19:59:27 UTC 2014


2014-08-12 21:18 GMT+02:00 Wojciech Narczyński <wojtek at power.com.pl>:

> W dniu 2014-08-12 01:22, Alberto G. Corona pisze:
>
>> But formlets are implemented in the server side.  and you probably think
>> in applications with heavy use of JavaScript for validations, interaction
>>  etc. In this case, there is a formlet implementation in the client side,
>> which is my.. Ahem!... package hplaygroud:
>>
>> https://github.com/agocorona/hplayground
>>
>>  Very interesting, please allow a few questions about your approach:
>
> 1. Would it be possible to save a snapshot of a paritally filled form on
> the server?
>

hplayground is client side. but by means of Haste.Ajax it is possible to
send something to a server.

 do
         r  <- (+) <$> inputAndSend
                     <*> inputAndSend
         p  (show r) ++> noWidget
     where
     inputAndSend= do
         r <- inputInt Nothing `wake` OnKeyPress <++ br
         sendInt  r
         return r
     sendInt i=  send the int trough Haste.Ajax

 2. Would it be possible to display the sum before the values: 3 = [ 1] + [
>  2] <-- this is rendered HTML, not Haskell?
>
> yes, using "at":

 do
        wraw $ div  ! id "result" $ noHtml
         r  <- (+) <$> inputInt Nothing `wake` OnKeyPress <++ br
                     <*> inputInt Nothing `wake` OnKeyPress <++ br

         at "result" Html $ p  (show r) ++> noWidget


> (I thought I would have more questions, but somehow I can't think of any
> right now...)
>
> --
> Kind regards,
> Wojtek
>



-- 
Alberto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140812/16cad1bc/attachment.html>


More information about the Haskell-Cafe mailing list