-
Notifications
You must be signed in to change notification settings - Fork 337
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
Display form/pragma bugs #1494
Comments
The DisplayForm gets added to the stImports field, since it goes And stImports is not in the part of the state that gets restored. I'm not sure whether it should. Original comment by |
Fixed the part about (r Record.≡ a) Original comment by |
-- Another example:
postulate
I : Set
P : I → Set
record R (i : I) : Set₁ where
field
_∙_ : P i → P i → Set
module M₁ where
postulate
r : (i : I) → R i
i : I
x : P i
open module M₂ {i : I} = R (r i)
foo : x ∙ x
foo = ?
-- The goal type is x ∙ x. Good!
--
-- The normalised goal type is (r i R.∙ x) x. Bad! (Can this be
-- improved without the use of display pragmas?)
--
-- Let's try to fix this using the following display pragma, placed
-- just before foo:
--
-- {-# DISPLAY R._∙_ _ x y = x ∙ y #-}
--
-- Now both the goal type and the normalised goal type are x ∙ x.
-- Good!
--
-- Let's now add a parameter to M₁:
--
-- module M₁ (X : Set) where
--
-- The goal type is still x ∙ x. Good! However, the normalised goal
-- type is _∙_ x. Very bad!
--
-- Yet another example:
postulate
I : Set
P : I → Set
record R (i : I) : Set₁ where
field
_∙_ : P i → P i → Set
module M₂ (r : (i : I) → R i) where
postulate
i : I
x : P i
open module M₃ {i : I} = R (r i)
{-# DISPLAY _∙_ _ x y = x ∙ y #-}
foo : x ∙ x
foo = ?
-- The goal type is _∙_ x. Very bad! The normalised goal type is
-- (r i R.∙ x) x. Bad!
--
-- It seems as if display pragmas don't work properly inside
-- parametrised modules.
Original comment by |
This is working as intended. Display pragma right-hand sides are checked in the empty context (i.e. outside the module telescope), so if you want to use names from a parameterised module in the right-hand side of a display pragma you need to supply values for the module parameters as well. If you didn't it's not at all clear what to do outside the module. For instance, postulate
F : Set → Set
D : Set
module M (A : Set) where
postulate G : Set → Set
{-# DISPLAY F X = G X #-} -- this should be F X = G e X, for some e, but if it wasn't...
foo : F A
foo = {!!} -- ...and we wanted this to print as G A
open M
bar : F D
bar = {!!} -- then what do we do here? G ?? A |
Bug-helper.agda:
Bug.agda:
Original issue reported on code.google.com by
nils.anders.danielsson
on 29 Apr 2015 at 4:40The text was updated successfully, but these errors were encountered: