Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Implicit DISPLAY pragma of pattern synonym doesn't trigger in this one specific case #8276

@meithecatte

Description

@meithecatte

Load the following file:

data A : Set where
  bad  : A
  very : A  A

pattern good = very bad

-- {-# DISPLAY very bad = good #-}

data P : A  Set where

data Q : A  Set where
  cons :  {q}  P q  Q q

Wrap : Set
Wrap = Q good

x : Wrap
x = cons {! !}

y : Q (very bad)
y = ?

Agda 2.8.0 displays:

Visible Goals:
?0 : (P (very bad))
?1 : Q good

I would expect something closer to what happens if I un-comment the explicit DISPLAY pragma:

Visible Goals:
?0 : (P good)
?1 : Q good

[there's also the question of P good getting parenthesized for no particular reason, but that one is less pressing]

This is especially puzzling considering that the documentation for pattern synonyms states:

For each pattern pattern lhs = rhs, Agda declares a DISPLAY pragma refolding rhs to lhs (see The DISPLAY pragma for more details).

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