[mercury-users] define predicate with currying?
Mark Brown
mark at csse.unimelb.edu.au
Fri Jan 6 00:16:18 AEDT 2012
Hi Michael,
On 05-Jan-2012, Michael Hendricks <michael at ndrix.org> wrote:
> I have the following simple program:
>
> main(!IO) :-
> hello([s("World")], !IO),
> hello([s("Mercury")], !IO).
>
> :- pred hello(list(string.poly_type)::in, io::di, io::uo).
> hello(Xs,!IO) :- format("Hello, %s!\n",Xs,!IO).
>
> Is it possible to define 'hello' by currying 'format'?
No, Mercury doesn't support full currying like Haskell or ML. The
underlying reason is that, in Mercury, a constant function returning X
is not the same value (or type) as X, so curried definitions would be
ambiguous.
Cheers,
Mark.
--------------------------------------------------------------------------
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