[mercury-users] Colon as a type constructor?

Ondrej Bojar oboj7042 at ss1000.ms.mff.cuni.cz
Tue May 15 00:46:56 AEST 2001


Aha.

So it's not possible to use the colon at all, or could I (if I really
wanted to -- which is no more the case :-) define a type with type
constructor mymodule:`:`?

And what does :: in type definitions mean?

One of my error messages says:

dagorunify.m:060: In clause for predicate `dagorunify:nunify/3':
dagorunify.m:060:   in argument 1 of clause head:
dagorunify.m:060:   type error in unification of variable `HeadVar__1'
dagorunify.m:060:   and functor `orlist/1'.
dagorunify.m:060:   variable `HeadVar__1' has type `(list:list((dagorunify:dagpair)))',
dagorunify.m:060:   functor `orlist/1' has type
dagorunify.m:060:   `orlist((list:list(A))) :: (dagorunify:orlist_t(A))'.

----

Line 60:
 nunify(orlist(Dags1), orlist(Dags2), orlist(Res)) :-

And the typedefs:
:- type dag == list(dagpair).
:- type dagorlist == orlist_t(dag).
:- type orlist_t(A) ---> orlist(list(A)).
...

Thanks.

On Mon, 14 May 2001, Fergus Henderson wrote:
> On 14-May-2001, Ondrej Bojar <oboj7042 at ss1000.ms.mff.cuni.cz> wrote:
> > I'd like to write pairs with colons and not with dashes :-)
> > But colonpair won't work:
> >
> > :- type colonpair(A, B) ---> A : B.
> >
> > Error: invalid RHS of type definition: A : B.
> >
> > (I didn't find anywhere that this is not permitted.)
>
> A better error message would be "module name identifier expected before
> ':' in qualified symbol name".
>
> Currently ":" is the module qualification operator.
> The left-hand operand must be a module name.
>
>

--------------------------------------------------------------------------
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