Skip to content
This repository was archived by the owner on Aug 15, 2018. It is now read-only.
This repository was archived by the owner on Aug 15, 2018. It is now read-only.

sugar for creating types #1

@mndrix

Description

@mndrix

Imagine the following two type definitions in mavis:

:- multifile error:has_type/2.
error:has_type(even_integer, X) :-
    0 is X mod 2.
error:has_type(north_american_country, X) :-
   memberchk(X, [usa, canada, mexico]).

That's more verbose (and error prone) than I'd like. I'd prefer to write:

:- type even_integer ---> 0 is X mod 2.
:- type north_american_country ---> usa; canada; mexico.

The basic notation is similar to Mercury while allowing arbitrary type checks (such as even_integer). This can be implemented with a relatively easy term_expansion/2 macro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions