[Ur] Error handling in Ur

Adam Chlipala adamc at csail.mit.edu
Mon Apr 4 17:21:53 EDT 2016


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, foldr at tutanota.com 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 adamc at csail.mit.edu <mailto: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/ddecc5b0/attachment.html>


More information about the Ur mailing list