[mercury-users] Existential types and list.map

Peter Hawkins peter at hawkins.emu.id.au
Fri Jul 29 11:17:27 AEST 2005


Hi...

Why doesn't this work?

:- module test3.
:- interface.
:- import_module io.

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

:- implementation.

:- import_module list.

:- some [T] func get_thing(int) = T.
get_thing(X) = X.

main(!IO) :-
    X = [1,2],
    Y = map(get_thing, X),
    io.print(Y, !IO),
    io.nl(!IO),
    true.

I get the misleading error message:
$ mmc --make test3
Making Mercury/int3s/test3.int3
Making Mercury/cs/test3.c
test3.m:016: In clause for predicate `test3.main/2':
test3.m:016:   in argument 1 of functor `map/2':
test3.m:016:   error: undefined symbol `get_thing/0'.

=)
Peter
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list