Created
May 26, 2018 20:16
-
-
Save jcreedcmu/063860980cc778b86b4f4c0e9e9e1900 to your computer and use it in GitHub Desktop.
a.agda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# OPTIONS --rewriting #-} | |
| module a where | |
| infix 30 _↦_ | |
| postulate | |
| _↦_ : ∀ {i} {A : Set i} → A → A → Set i | |
| {-# BUILTIN REWRITE _↦_ #-} | |
| data Foo : Set where | |
| a b c : Foo | |
| data Unit : Set where | |
| none : Unit | |
| func : Foo → Unit → Foo | |
| func x none = x | |
| alias : (t : Foo) (x : Unit) → Foo | |
| alias t x = func t x | |
| -- This I can do just fine: | |
| -- postulate | |
| -- rw-good : (x : Unit) (t : Foo) → func t x ↦ t | |
| -- {-# REWRITE rw-good #-} | |
| -- But the following fails: | |
| postulate | |
| rw-bad : (x : Unit) (t : Foo) → alias t x ↦ t | |
| {-# REWRITE rw-bad #-} | |
| -- with error message: | |
| -- rw-bad is not a legal rewrite rule, since the left-hand side | |
| -- alias t x reduces to func t x | |
| -- when checking the pragma REWRITE rw-bad | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment