Arc Forumnew | comments | leaders | submit | murk's commentslogin

Haskell:

    serveAs "said" $ hasIndex $ \x -> "click me" `linksTo` (text ("You said " ++ x))

-----

12 points by vegai 6125 days ago | link

It looks like it is using a hypothetical web library.

Certainly would be interesting to see it implemented.

-----

7 points by hagbart 6125 days ago | link

could you explain that code a bit? Which framework are you using?

-----

2 points by purejadekid 6123 days ago | link

This time, some real code in Haskell:

------

said = standardQuery "What's your name?" (p_T (do { text_S "Hi there! What's your name?" ; activate greeting textInputField empty }))

greeting :: String -> CGI ()

greeting name = standardQuery "Hello" (do { text_S "Hello " ; text name ; text_S ". This is my first interactive CGI program!" })

------

where said <==> helo5, code at http://www.informatik.uni-freiburg.de/~thiemann/WASH/Tutoria...

Try it, live (chose Hellow World Personalized):

http://nakalele.informatik.uni-freiburg.de/cgi/WASH/Tutorial...

-----

7 points by ingspree 6125 days ago | link

But... Where is the form? I just don't understand.

-----

4 points by Gotttzsche 6125 days ago | link

It looks like the \x does the form. O_o That would be weird.

The last part looks pretty lispy.

Does this mean Haskell wins against Arc? :p

-----

3 points by murk 6125 days ago | link

I apologize; `hasIndex` is a confusing name -- I was thinking of the `ISINDEX` html tag (it creates an html form with a single input field).

The idea is that `hasIndex f` creates a page that prompts for a string, then (after the page is submitted) calls the function f with the input string as parameter and shows the resulting page.

By the way, \ is just the Haskell syntax for lambda -- hey, whaddayaknow, it's one character shorter than `fn` :-)

-----

1 point by ingspree 6125 days ago | link

Hm,, interesting idea, though hasIndex can be written in Arc to simplify their code.

But I like Haskell. :-) Interesting, how long will be explicit declaration of form.

BTW, this is your imagination or you are using something real and this can be used just now for web programming?

-----

5 points by murkt 6125 days ago | link

Brilliance!

-----