[mercury-users] Higher-order unification question
Ralph Becket
rafe at csse.unimelb.edu.au
Tue Feb 27 11:51:40 AEDT 2007
doug.auclair at logicaltypes.com, Monday, 26 February 2007:
> Hi, I receive an error when I pass in an applied higher order term.
> What am I doing wrong?
>
> The goal's type:
>
> :- pred svunfold(counter, pred(T, T, SV, SV), T, T, SV, SV).
> :- mode svunfold(in, pred(in, out, in, out) is det, in, out, in, out)
> is det.
>
> The argument def:
>
> Rnds = (pred(P::(pred(in, in, out) is det), A::in, B::out,
> RNG0::in, RNG::out) is det :-
> P(X, RNG0, RNG),
> B = [X|A]),
>
> the call:
>
> svunfold(counter(10), Rnds(random_int), [], Ans, J0, _),
Rnds has arity 5, svunfold expects a predicate of arity 4.
> (where random_int/3 is from Julian's typeclassed RNG protocol).
>
> The exact compile error message:
>
> test_series.m:026: In clause for predicate `main'/2:
> test_series.m:026: in argument 2 of call to predicate `svunfold'/6:
> test_series.m:026: in unification of argument
> test_series.m:026: and term `Rnds(V_55)':
> test_series.m:026: type error in argument(s) of higher-order term (with arity
> test_series.m:026: 1).
> test_series.m:026: Functor (Rnds) has type `pred(pred(T, V_7, V_6),
> test_series.m:026: (list.list(T)), (list.list(T)), V_7, V_6)',
> test_series.m:026: expected type was `((func V_10) = V_11)'.
> ** Error making `Mercury/cs/test_series.c'.
> make: *** [test_series] Error 1
>
> Why is it looking for (func T0) = T1 as the type? It should be looking for
I have no idea. Have you given us enough information?
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list