[m-users.] Higher-order predicates and functions and equivalence types.

Volker Wysk post at volker-wysk.de
Sat Aug 28 21:47:51 AEST 2021


Am Samstag, dem 28.08.2021 um 09:00 +0200 schrieb Volker Wysk:
> Am Freitag, dem 27.08.2021 um 20:26 +0100 schrieb Sean Charles
> (emacstheviking):
> > Hi,
> > 
> > I have a type definition like this:
> > 
> > :- type tcon
> >     --->    tcon(
> >                 options  :: felt_options,
> >                 output   :: list(rop),
> >                 warnings :: lserror,
> >                 errors   :: lserror,
> >                 render   :: pred(instruction::in, string::in, string::out) is semidet
> >                 % ENV[] stack can go in here too
> >             ).
> > 
> > The `render` field, I wanted to be able to code this something like:
> > 
> >     render :: foo
> > 
> > where foo would have been defined as
> > 
> > :- type foo = (pred(instruction::in, string::in, string::out) is semidet).
> 
> I'm not sure, but you have the type and modes in your type "foo". I think
> you can only have the type in a type synonym. You also need to equal signs.

Again:

You have specified the types and the modes of the predicate arguments in
your "foo" type synonym. There's also the determinism category. I think, you
can only specify the types in a ":- type" statement. 

You also have one equal sign. Those should be two.

Hope this is more intelligible than my previous post.

Have fun,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20210828/04e18149/attachment.sig>


More information about the users mailing list