Skip to content

Commit bee4f91

Browse files
authored
Add Reflection.Universe (#1324)
1 parent 6f78e03 commit bee4f91

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ New modules
6464
* Added `Reflection.Traversal` for generic de Bruijn-aware traversals of reflected terms.
6565
* Added `Reflection.DeBruijn` with weakening, strengthening and free variable operations
6666
on reflected terms.
67+
* Added `Reflection.Universe` defining a universe for the reflected syntax types.
6768

6869
Other major changes
6970
-------------------

src/Reflection/Universe.agda

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
------------------------------------------------------------------------
2+
-- The Agda standard library
3+
--
4+
-- A universe for the types involved in the reflected syntax.
5+
------------------------------------------------------------------------
6+
7+
{-# OPTIONS --without-K --safe #-}
8+
9+
module Reflection.Universe where
10+
11+
open import Data.List.Base using (List)
12+
open import Data.String.Base using (String)
13+
open import Data.Product using (_×_)
14+
open import Reflection.Argument using (Arg)
15+
open import Reflection.Abstraction using (Abs)
16+
open import Reflection.Term using (Term; Pattern; Sort; Clause)
17+
18+
data Univ : Set where
19+
⟨term⟩ : Univ
20+
⟨pat⟩ : Univ
21+
⟨sort⟩ : Univ
22+
⟨clause⟩ : Univ
23+
⟨list⟩ : Univ Univ
24+
⟨arg⟩ : Univ Univ
25+
⟨abs⟩ : Univ Univ
26+
⟨named⟩ : Univ Univ
27+
28+
pattern ⟨tel⟩ = ⟨list⟩ (⟨named⟩ (⟨arg⟩ ⟨term⟩))
29+
30+
⟦_⟧ : Univ Set
31+
⟦ ⟨term⟩ ⟧ = Term
32+
⟦ ⟨pat⟩ ⟧ = Pattern
33+
⟦ ⟨sort⟩ ⟧ = Sort
34+
⟦ ⟨clause⟩ ⟧ = Clause
35+
⟦ ⟨list⟩ k ⟧ = List ⟦ k ⟧
36+
⟦ ⟨arg⟩ k ⟧ = Arg ⟦ k ⟧
37+
⟦ ⟨abs⟩ k ⟧ = Abs ⟦ k ⟧
38+
⟦ ⟨named⟩ k ⟧ = String × ⟦ k ⟧

0 commit comments

Comments
 (0)