{-# OPTIONS --safe --with-K #-}
module Examples.WithMacros.W where
open import Prelude hiding (lookupAny)
open import Generics.Description
open import Generics.Recursion
open import Generics.Reflection
open import Generics.RecursionScheme
open import Generics.SimpleContainer
open import Generics.SimpleContainer.Any
data W (A : Set ℓ) (B : A → Set ℓ') : Set (ℓ ⊔ ℓ') where
sup : (a : A) → (B a → W A B) → W A B
instance
WC : Named (quote W) _
unNamed WC = genDataC WD (genDataT WD W)
where WD = genDataD W
private
indWP : IndP
indWP = ind-operator (quote W)
unquoteDecl indW = defineInd indWP indW
instance indWC = genIndC indWP indW
instance
WS : SCᵈ (findDataD (quote W))
WS = record
{ El = λ (A , _) → A
; pos = (true ∷ tt ∷ []) ∷ []
; coe = λ _ → (refl ,ωω λ _ → lift tt) ,ωω lift tt }
private
WAnyD : DataD
WAnyD = AnyD (quote W)
unquoteDecl data WAny constructor here there = defineByDataD WAnyD WAny (WAny.here ∷ WAny.there ∷ [])
instance
WAnyC : Named (quote WAny) _
unNamed WAnyC = genDataC WAnyD WAnyT where WAnyT = genDataT WAnyD WAny
private
lookupWAnyP : FoldP
lookupWAnyP = lookupAny (quote W)
unquoteDecl lookupWAny = defineFold lookupWAnyP lookupWAny
instance lookupWAnyC = genFoldC lookupWAnyP lookupWAny