There's no standard way of doing such things, beyond the tenuously connected example of the [option] monad. "urweb-monad-pack" may indeed be the best starting point.

On 04/04/2016 06:49 AM, [email protected] wrote:
Adam, I thought that [error] could be used as the last resort - when something severe happens.

What would be the right approach to get rid of multiple enclosed case/if statements? Imagine user input validation in a complex data entry form - all data inconsistencies produce different error messages and all require form resubmission. The code at [1] would be an example of how such error handling could be rewritten, but I would like to declare multiple error types and pattern match them.

[1] https://github.com/grwlf/urweb-monad-pack/blob/master/test/TestError1.ur



4. Apr 2016 21:48 by [email protected] <mailto:[email protected]>:

    The idiomatic approach is just to call the [error] function to end
    execution, with an error message.

    On 04/03/2016 10:24 PM, [email protected] wrote:

        Hi all,

        How do I handle application errors in Ur? Is there a preferred
        method which allows to check whether all errors have their
        handlers or not?

        I am looking for maybe something similar to the below:
        
http://sylvain-henry.info/home/posts/2016-03-18-first-experiments-with-dependent-types.html

_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to