<div dir="ltr">> 
So I should re-phrase my question: <br>> Has anyone extended tangible values to Generic types and given them a<br><div>> modern html interface? <br></div><div><br></div><div>I think the answer is "no"; and it would be extremely great if someone did.</div><div><br></div><div>But I think at least part of the problem is that one is forced to marry oneself to a particular web framework/JavaScript library, and is therefore immediately out of date :(</div><div><br></div><div>Personally, back in the day I quite like the API put out by Yesod for auto-generating forms - <a href="https://www.yesodweb.com/book/forms">https://www.yesodweb.com/book/forms</a> - but I don't think it quite does what you want. Maybe it's a simple adaptation, though (of course, forcing yourself to use a particular flavour of javascript/styling approach).<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 2 Mar 2023 at 16:41, Olaf Klinke <<a href="mailto:olf@aatal-apotheke.de">olf@aatal-apotheke.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 2023-03-02 at 07:34 -0800, Ivan Perez wrote:<br>
> All of this reminds me of Conal Elliott's Tangible Values.<br>
> <br>
> <a href="http://conal.net/papers/Eros/" rel="noreferrer" target="_blank">http://conal.net/papers/Eros/</a><br>
> <br>
> (Not for web but the idea still applies.)<br>
> <br>
> Ivan<br>
<br>
Yes, the concept has been re-invented multiple times, as is the case<br>
with most good ideas. TVs are general enough to bolt a web interface on<br>
top, I guess. <br>
<br>
Seems that Conal, too, has not solved the sum type problem. <br>
The tangible value GADT <br>
<a href="https://hackage.haskell.org/package/TV-0.5.0/docs/Interface-TV-Input.html" rel="noreferrer" target="_blank">https://hackage.haskell.org/package/TV-0.5.0/docs/Interface-TV-Input.html</a><br>
has a Pair constructor but not for Sum. I wonder whether there is a<br>
deeper categorical reason for this. <br>
<br>
So I should re-phrase my question: <br>
Has anyone extended tangible values to Generic types and given them a<br>
modern html interface? <br>
<br>
Olaf<br>
<br>
> <br>
> On Thu, 2 Mar 2023 at 07:02, Olaf Klinke <<a href="mailto:olf@aatal-apotheke.de" target="_blank">olf@aatal-apotheke.de</a>> wrote:<br>
> <br>
> > On Thu, 2023-03-02 at 15:51 +0200, Georgi Lyubenov wrote:<br>
> > > Hey Olaf,<br>
> > > <br>
> > > This is not an answer to your question, but I was reminded of Grace[0],<br>
> > > which is a language<br>
> > > with a "browser"[1] that allows you to type in terms and get back<br>
> > > webpages based on those terms<br>
> > > "automagically", which sounds like exactly what you need. I don't know<br>
> > > how it's implemented, so I don't know if<br>
> > > it is actually relevant to you, but it is worth noting that Grace itself<br>
> > > is implemented in Haskell.<br>
> > > <br>
> > > Cheers,<br>
> > > Georgi<br>
> > > <br>
> > > [0] <a href="https://github.com/Gabriella439/grace" rel="noreferrer" target="_blank">https://github.com/Gabriella439/grace</a><br>
> > > [1] <a href="https://trygrace.dev/" rel="noreferrer" target="_blank">https://trygrace.dev/</a><br>
> > > <br>
> > > On 3/2/23 12:54, Olaf Klinke wrote:<br>
> > > > Dear Cafe,<br>
> > > > <br>
> > > > has anyone ever attempted (and maybe succeeded) in building dynamic<br>
> > > > forms using one of the Haskell web frameworks (Yesod,Servant,...)?<br>
> > > > By "dynamic" form I mean a form that changes the number of fields based<br>
> > > > on selections the user makes in other fields of the form.<br>
> > > > <br>
> > > > For example, say one has an algebraic data type<br>
> > > > <br>
> > > >      data T = Number Int | Check Bool T<br>
> > > > <br>
> > > > A form for such a type would initially consist of radio buttons or a<br>
> > > > drop-down list with options "Number" and "Check" that lets the user<br>
> > > > select the constructor. When "Number" is selected, an <input<br>
> > > > type="number"> field is shown. When "Check" is selected, an <input<br>
> > > > type="checkbox"> is displayed next to another form of this kind.<br>
> > > > <br>
> > > > In the end, one would use the GHC.Generics machinery to generate forms<br>
> > > > for a wide range of algebraic data types. I've seen this in the Clean<br>
> > > > language's iTask library [1] and it's very convenient.<br>
> > > > Of course this would involve a lot of JavaScript like<br>
> > > > document.createElement() as well as book-keeping how to re-asseble the<br>
> > > > fields into a T value upon submission. At least the latter is already<br>
> > > > handled by libraries such as yesod-form.<br>
> > > > <br>
> > > > Olaf<br>
> > > > <br>
> > > > [1] <a href="https://cloogle.org/src/#itasks/iTasks/UI/Editor/Generic" rel="noreferrer" target="_blank">https://cloogle.org/src/#itasks/iTasks/UI/Editor/Generic</a><br>
> > > > [2] <a href="https://github.com/haskell-servant/servant-swagger/issues/80" rel="noreferrer" target="_blank">https://github.com/haskell-servant/servant-swagger/issues/80</a><br>
> > > > <br>
> > > > <br>
> > <br>
> > Thanks for the pointer!<br>
> > <br>
> > The Grace README says under Notable Omissions:<br>
> > <br>
> > > Recursion or recursive data types<br>
> > > <br>
> > > Grace only supports two built-in recursive types, which are List and<br>
> > > JSON, but does not support user-defined recursion or anonymous<br>
> > > recursion.<br>
> > > <br>
> > > User-defined datatypes<br>
> > > <br>
> > > All data types in Grace are anonymous (e.g. anonymous records and<br>
> > > anonymous unions), and there is no concept of a data declaration<br>
> > <br>
> > The tutorial shows how Grace function inputs are mapped to forms, where<br>
> > functions with List input indeed have a form that is "dynamic" in the<br>
> > sense I defined. Otherwise there is only one input field per function<br>
> > argument. That means complex types are to be input in JSON syntax and<br>
> > parsed.<br>
> > Instead of a DSL, I'd prefer a shallow embedding into Haskell, so that<br>
> > one can leverage all the available machinery.<br>
> > Yet Grace already goes a long way towards what I am after.<br>
> > <br>
> > Olaf<br>
> > <br>
> > <br>
> > <br>
> > <br>
> > <br>
> > <br>
> > _______________________________________________<br>
> > Haskell-Cafe mailing list<br>
> > To (un)subscribe, modify options or view archives go to:<br>
> > <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
> > Only members subscribed via the mailman list are allowed to post.<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr">Noon van der Silk, ن<br><br><a href="http://silky.github.io/" target="_blank">http://silky.github.io/</a><br><br>"My programming language is kindness."</div></div></div>