Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inferred types are not aware of schematic variables #1

Open
nsbgn opened this issue Apr 12, 2021 · 0 comments
Open

Inferred types are not aware of schematic variables #1

nsbgn opened this issue Apr 12, 2021 · 0 comments
Labels
type-inference Improvements to the type inference algorithm.

Comments

@nsbgn
Copy link
Contributor

nsbgn commented Apr 12, 2021

Consider the following function:

compose = Operation(
    lambda α, β, γ: (β ** γ) ** (α ** β) ** (α ** γ),
    derived=lambda f, g, x: f(g(x))
)

Clearly, the type inferred from the derivation should correspond to the
declared type for this operation. However, swapping the arguments in the
declared type does not immediately lead to an error:

compose = Operation(
    lambda α, β, γ: (α ** β) ** (β ** γ) ** (α ** γ),
    derived=lambda f, g, x: f(g(x))
)

An error will still be raised, but only once we use it:

A = Type.declare("A")
B = Type.declare("B")
C = Type.declare("C")
op1 = Operation(A ** B)
op2 = Operation(B ** C)
compose(op2, op1)

It would be helpful if the wrong declared type were immediately caught at the
time that it is defined.

@nsbgn nsbgn added the bug Something isn't working label Apr 12, 2021
@nsbgn nsbgn added type-inference Improvements to the type inference algorithm. and removed bug Something isn't working labels Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-inference Improvements to the type inference algorithm.
Projects
None yet
Development

No branches or pull requests

1 participant