Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jcreedcmu/063860980cc778b86b4f4c0e9e9e1900 to your computer and use it in GitHub Desktop.

Select an option

Save jcreedcmu/063860980cc778b86b4f4c0e9e9e1900 to your computer and use it in GitHub Desktop.
a.agda
{-# 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