[m-dev.] alternative syntax for pred declarations.
Andrew Bromage
bromage at cs.mu.oz.au
Mon Dec 1 11:09:54 AEDT 1997
G'day.
Thomas Charles CONWAY wrote:
> It would be nice to be able to write:
>
> :- type parser(T) == pred(maybe(T), parse_state, parse_state).
>
> :- mode parser :: (pred(out, in, out) is det).
>
> :- pred this_parser = parser(xxx).
> :- mode this_parser = parser.
I agree with Fergus that this is not quite the right syntax.
Since the current plan is to use ':' for type qualifiers and '::' for
mode qualifiers, so I guess it would make sense to use these here too:
:- pred this_parser : parser(xxx).
:- mode this_parser :: parser.
If we want to do currying:
:- pred match_token(token) : parser(unit).
:- mode match_token(in) :: parser is det.
The first declaration should be read, `the pred match_token(token) has
type parser(unit)'.
Alternatively, if you want to be more compact (and less legible):
:- pred match(token :: in) : (parser(unit) :: parser) is det.
Cheers,
Andrew Bromage
More information about the developers
mailing list