Visitar URL original
Instance resolution bug with `Functor-Vec` · Issue #27 · agda/agda-stdlib-classes · GitHub
Skip to content

Instance resolution bug with Functor-Vec #27

Open

Description

@WhatisRT

This code fails to check:

module Test where

open import Class.Prelude
open import Class.Functor

private variable X Y : Type

test : ∀ {f : X} {x : Maybe (List Y)} → fmap (_++ []) x ≡ just []
test = {!!}

See agda/agda#8316 for full context. In this case, we get the following error:

  Resolve instance argument _r_13 : Functor _F_32
  Candidates
    Functor-Maybe : Functor Maybe
    Functor-Vec : ({n : ℕ} → Functor (flip Vec n))
    (stuck)

Note that there is absolutely no reason that Vec should show up here. So I'd suggest we mark Functor-Vec as INCOHERENT (or just not as an instance at all) for now. Thoughts @omelkonian?

Activity

  1. omelkonian commented on Jan 12, 2026

    @omelkonian
    Collaborator

    To me, this seems like an Agda bug (caused by the unused {f : X} argument), so we shouldn't change anything on our side.

    For now, setting fmap {F = Maybe} to help the type inference should suffice.

  2. WhatisRT commented on Jan 13, 2026

    @WhatisRT
    CollaboratorAuthor

    Yeah, this is an Agda bug but it showed up in a real use case where f wasn't unused. I think it's better to have a temporary fix once here than on every use site.

  3. omelkonian commented on Jan 13, 2026

    @omelkonian
    Collaborator

    Hmm don't know, this feels wrong to me. In the same vain, you would add workarounds like this for every Agda instance-related bug, and even worse you would have to revert them when the bugs are fixed.

    Moreover, the Vec instance here is completely unrelated, so this could manifest from other instances (even user-written ones), hence this temporary fix is not even a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions