[m-dev.] Is this a bug?

Ralph Becket rafe at csse.unimelb.edu.au
Mon Jun 18 13:42:29 AEST 2007


I'm trying to use field update syntax to update a map of maps, but it
isn't working:

::: map_map_update_test.m :::

:- module map_map_update_test.
:- interface.
:- import_module io.

:- pred main(io::di, io::uo) is det.

:- implementation.
:- import_module map.

main(!IO) :-
    A0 = map.init,
    A  = A0 ^ elem(42) ^ elem(99) := 123,
    io.write_int(A ^ det_elem(42) ^ det_elem(99), !IO),
    io.nl(!IO).

::: end of map_map_update_test.m :::

$ mmc --make map_map_update_test
Making Mercury/int3s/map_map_update_test.int3
Making Mercury/cs/map_map_update_test.c
map_map_update_test.m:005: In `main'(di, uo):
map_map_update_test.m:005:   error: determinism declaration not satisfied.
map_map_update_test.m:005:   Declared `det', inferred `semidet'.
map_map_update_test.m:012:   In unification with `elem(V_10, A0)':
map_map_update_test.m:012:   call to `map.elem'(in, in) = out can fail.
** Error making `Mercury/cs/map_map_update_test.c'.


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list