[m-dev.] ui arguments in closures

Ralph Becket rafe at csse.unimelb.edu.au
Mon Jun 23 16:00:37 AEST 2008


This is pertinent to G12.

I have a predicate

:- pred output_environment(solver::in, env::in, ps::ui, io::di, io::uo) is det.

output_environment(Solver, Env, PS, !IO) :-
    map.foldl(output_env_var(Solver, PS), Env, !IO).	% --- Line 1023 ---

:- pred output_env_var(solver::in, ps::ui, name::in, value::in, io::di, io::uo)
	is det.

...

The compiler is complaining thus:
flatzinc_solver.m:1023: In clause for `output_environment(in, in, ui, di, uo)':
flatzinc_solver.m:1023:   in argument 2 of call to predicate
flatzinc_solver.m:1023:   `flatzinc_solver.output_env_var'/6:
flatzinc_solver.m:1023:   mode error: variable `PS' has instantiatedness
flatzinc_solver.m:1023:   `ground',
flatzinc_solver.m:1023:   expected instantiatedness was `unique'.

Do I take it that ui arguments in closures are treated as ground by the
compiler?  If so, is this a bug or is there a reason for this behaviour?

-- Ralph
--------------------------------------------------------------------------
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