Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eta-equivalence violation in curried argument to solutions() #36

Open
ulidtko opened this issue Oct 12, 2015 · 0 comments
Open

Eta-equivalence violation in curried argument to solutions() #36

ulidtko opened this issue Oct 12, 2015 · 0 comments

Comments

@ulidtko
Copy link

ulidtko commented Oct 12, 2015

This code compiles:

:- pred foo is semidet.
foo :-
    P = (pred(A::in, V::out) is nondet :- V = A + 1),
    solutions(
        (pred(Y::out) is nondet :- P(13, Y)),
        _)
    .

This (supposedly equivalent) modification does not:

:- pred foo is semidet.
foo :-
    P = (pred(A::in, V::out) is nondet :- V = A + 1),
    solutions(
        P(13),
        _)
    .

Error message:

$ mmc --grade hlc.gc.pregen -E hello.m
hello.m:017: In clause for predicate `foo'/0:
hello.m:017:   in argument 1 of call to predicate `solutions'/2:
hello.m:017:   in unification of argument
hello.m:017:   and term `P(V_9)':
hello.m:017:   type error in argument(s) of higher-order term (with arity 1).
hello.m:017:   Functor (P) has type `pred(int, int)',
hello.m:017:   expected type was `((func V_3) = V_4)'.

which is obscure and completely unhelpful. What does even a type ((func V_3) = V_4) mean?

juliensf pushed a commit that referenced this issue Jun 23, 2016
This bug was reported against rotd-2008-01-14; the problem does not occur with
rotd-2016-06-23, although I'm not sure if that's because the original issue has
been fixed or if there is just something masking it.

tests/valid/bug36.m:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
     Add the test case for bug #36.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant