I think the way Jon Sterling integrated validation in his extensible library might give some inspiration about using a similar approach to solve the specific problem you describe.

He did a great talk about it recently, I highly recommend it:
http://t.co/ZKceAY5zAz

Cheers

Alois



On 11 August 2014 23:16, Wojtek Narczyński <wojtek@power.com.pl> wrote:
Dear All,

Haskell is great for great many areas, let me name just two: - parsers, translators, interpreters, compilers; highly concurrent systems.

Haskell is however not great for GUIs. I've been thinking a little why this is so. I think one of the reasons might be that in Haskell it is unusual to deal with data that is incomplete or otherwise erroneous. Let me try to explain, what I mean, by example. If you declare Person class in Java, you automatically get a thingy that you can readily use in UI construction, because all the fields can temporarily be null, even the required ones. In Haskell you'd need two data types: the usual proper Haskell data type, and another which wraps every field in Maybe, facilitates editing, validation, etc. Perhaps it would be possible to generate one data type from the other, or generate both from a common specification.

Let me write the same thing in other words. It is not controversial to say on this list that specifying what is correct means, is a good idea. But for GUIs, in addition to the strong type, you need another relaxed type to hold the values temporarily, until the human manages to deliver correct data, often by trial and error.

Comments welcome.

--
Kind regards,
Wojtek Narczyński

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
Λ\ois
http://twitter.com/aloiscochard
http://github.com/aloiscochard