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

Wojtek Narczyński wojtek at power.com.pl
Thu Aug 14 08:48:34 UTC 2014


On 14.08.2014 01:21, Tom Ellis wrote:
>
> Perhaps I don't grasp exactly what you're getting at, but this seems easy.
> Please let me know where my proposed solution fails to provide what you
> need.
>
> I do see that you originally said "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.".  You don't actually *need*
> the version without the Maybe, but you can provide it if you want some
> additional type safety.

Yes! This is what I mean.

But there is much more to validation, than just missing values. For text 
fields you have lengths, regexps. For numeric fields you have ranges, 
steps. Then come rules that are inter-fleld: if this field is "Yes", 
that field must be filled, if the user chooses "No" a field should be 
hidden, if the user changes his mind, the value entered should be 
preserved (not validation, but related). Then come rules that are 
inter-record: if this field is "ExportInvoice", all VAT fields in the 
LineItem must be zero.

The difficulty lies in abundance, ubiquity and complexity of the 
validation rules.

Empty fields are just an innocent example. The code you provided solves 
it well, but this is just a tip of an iceberg.

And we still haven't even touched the subject of assisting the user to 
fix the inconsistencies.

Therefore, quite frankly, I was hoping for radical new ideas how to 
tackle this, when I was starting this thread. DSLs, logic, Attribute 
Grammars, something like that.


More information about the Haskell-Cafe mailing list