Skip to content

Check constructor against datatype. #1

@KonjacSource

Description

@KonjacSource
def two: Nat = suc (suc zero)

data Id : {A : U} (x y : A) -> U where
| refl : {A : U} (x : A) -> Id x x

data Exists: {A: U} {P: A -> U} -> U where
| intro: {A: U} {P: A -> U} (witness: A) (proof: P witness) -> Exists {A} {P}

def test: Exists {Nat} {Id two} = intro two (refl two)

shows

   |
10 | def exitstest: Exists {Nat} {Id two} = intro two (refl two)
   |                                                   ^
Cannot unify expected type

  ?22 two

with inferred type

  Id {Nat} two two
*** Exception: ExitSuccess

This should be ok if we check intro ... against the type Exist. But we didn't, the checking fallen to the last clause which is infer then judge equality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions