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

check types in clause heads #12

Open
mndrix opened this issue Dec 26, 2013 · 0 comments
Open

check types in clause heads #12

mndrix opened this issue Dec 26, 2013 · 0 comments

Comments

@mndrix
Copy link
Owner

mndrix commented Dec 26, 2013

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant