[Ur] Error handling in Ur

foldr at tutanota.com foldr at tutanota.com
Mon Apr 4 06:49:18 EDT 2016


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 adamc at csail.mit.edu:


>         The idiomatic approach is just to call the [error] function to end  
>   execution, with an error message.
>
>     > On 04/03/2016 10:24 PM,      > foldr at tutanota.com>  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
>>     
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20160404/bccb5da8/attachment.html>


More information about the Ur mailing list