| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Reflection utilities for Fin |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Data.Fin.Reflection where |
| 10 |
|
| 11 |
open import Data.Nat.Base as ℕ hiding (module ℕ) |
| 12 |
open import Data.Fin.Base as Fin hiding (module Fin) |
| 13 |
open import Data.List.Base using (List; _∷_; []; lookup) |
| 14 |
open import Reflection.AST.Term using (Term; con; _⋯⟅∷⟆_) |
| 15 |
open import Reflection.AST.Argument using (Arg; _⟨∷⟩_) |
| 16 |
|
| 17 |
------------------------------------------------------------------------ |
| 18 |
-- Term |
| 19 |
|
| 20 |
toTerm : ∀ {n} → Fin n → Term |
| 21 |
toTerm zero = con (quote Fin.zero) (1 ⋯⟅∷⟆ []) |
| 22 |
toTerm (suc i) = con (quote Fin.suc) (1 ⋯⟅∷⟆ toTerm i ⟨∷⟩ []) |