8000 Unification failure for function type with erased argument · Issue #6999 · agda/agda · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unification failure for function type with erased argument #6999
Closed
@nad

Description

@nad

The following code is accepted by Agda:

{-# OPTIONS --erasure #-}

postulate
  f : (P : Set  Set₁)  (A : Set)  P A

works : (A : Set)  @0 A  Set
works = f _

However, Agda fails to infer the value of the final underscore in the following variant of the code:

{-# OPTIONS --erasure #-}

postulate
  f : (P : @0 Set  Set₁)  (A : Set)  P A

fails : (A : Set)  @0 A  Set
fails = f _
_P_2 : @0 Set → Set₁  [ at […]:7,11-12 ]

———— Errors ————————————————————————————————————————————————
Failed to solve the following constraints:
  _P_2 A =< @0 A → Set (blocked on _P_2)

The problem can be fixed by replacing the underscore by (λ _ → @0 _ → _):

{-# OPTIONS --erasure #-}

postulate
  f : (P : @0 Set  Set₁)  (A : Set)  P A

works : (A : Set)  @0 A  Set
works = f (λ _  @0 _  _)

For some reason Agda fails to solve the constraint _P_2 A =< @0 A → Set.

I could seemingly fix the problem by tweaking the following code:

instance Occurs a => Occurs (Dom a) where
occurs :: Occurs a => Dom a -> OccursM (Dom a)
occurs v = traverse occurs v

New code:

  occurs (Dom info n f t x) =
    Dom info n f t <$> underQuantity info (occurs x)

I don't think a similar change should be performed for irrelevance, because the following code is rejected:

F : .(A : Set)  Set₁
F A = .A  Set

I also left the cohesion component of the modality unchanged, because I know too little about cohesion.

Metadata

Metadata

Assignees

Labels

constraintsConstraints (postponed type checking problems, postponed unification problems, instance constraints)erasuretype: bugIssues and pull requests about actual bugs

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0