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.

check types in clause heads #12

@mndrix

Description

@mndrix

Imagine a predicate defined as follows:

%% something(X:integer)
something(foo(_)).

There's an obvious disagreement between the documented types (integer) and the clause head (foo(_)). Here is a process for discovering these kinds of problems:

  • call is_of_type(integer, foo(_))
    • if success, the clause head is OK
  • generate random values of integer (using quickcheck:arbitrary/2) and try unifying them with foo(_)
    • if we find a single value that unifies, the clause head is OK
  • clause head is almost certainly wrong; show warning

We should export a predicate which answers the question "is this value possibly compatible with this type?" That step in the process seems like it might be useful elsewhere.

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