[m-users.] Converting an exception to a different exception
Volker Wysk
post at volker-wysk.de
Thu May 20 15:43:01 AEST 2021
P.S.:
I'm aware of the map.search function/predicate. It just occured to me that
it was interesting. In Haskell, there's a function (forgot its name), that
can do exactly that.
Am Donnerstag, den 20.05.2021, 07:39 +0200 schrieb Volker Wysk:
> Hi
>
> I want do convert an exception from one type to another. Like this:
>
>
> :- pred dir_to_name(pages::in, string::in, string::out) is det.
>
> dir_to_name({ _, DirNameM }, Dir, Name) :-
> ( try []
> map.lookup(DirNameM, Dir, Name)
> then
> true
> catch software_error(_) ->
> throw("Unknown page directory " ++ quote(Dir))
> ).
>
>
> This won't compile, because "A try goal has determinism cc_multi." (Mercury
> Reference Manual, chapter 12).
>
> Is there any way to do this?
>
> Regards,
> Volker
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20210520/7bb8fef0/attachment.sig>
More information about the users
mailing list