2023-04-15 09:13:01 -04:00
|
|
|
module Quox.Syntax.Term.TyConKind
|
|
|
|
|
|
|
|
import Decidable.Equality
|
|
|
|
import Derive.Prelude
|
|
|
|
import Generics.Derive
|
|
|
|
|
|
|
|
%language ElabReflection
|
|
|
|
%default total
|
|
|
|
|
|
|
|
|
|
|
|
public export
|
2023-11-01 10:17:15 -04:00
|
|
|
data TyConKind =
|
|
|
|
KTYPE | KIOState | KPi | KSig | KEnum | KEq | KNat | KString | KBOX
|
2023-04-15 09:13:01 -04:00
|
|
|
%name TyConKind k
|
|
|
|
%runElab derive "TyConKind" [Eq.Eq, Ord.Ord, Show.Show, Generic, Meta, DecEq]
|
|
|
|
|
|
|
|
||| a list of all `TyConKind`s
|
|
|
|
public export %inline
|
|
|
|
allKinds : List TyConKind
|
|
|
|
allKinds = %runElab do
|
|
|
|
-- as a script so it stays up to date if there are more tycon kinds
|
|
|
|
cs <- getCons $ fst !(lookupName "TyConKind")
|
|
|
|
traverse (check . var) cs
|
|
|
|
|
|
|
|
|
|
|
|
||| in `type-case`, how many variables are bound in this branch
|
|
|
|
public export %inline
|
|
|
|
arity : TyConKind -> Nat
|
2023-11-01 10:17:15 -04:00
|
|
|
arity KTYPE = 0
|
|
|
|
arity KIOState = 0
|
|
|
|
arity KPi = 2
|
|
|
|
arity KSig = 2
|
|
|
|
arity KEnum = 0
|
|
|
|
arity KEq = 5
|
|
|
|
arity KNat = 0
|
|
|
|
arity KString = 0
|
|
|
|
arity KBOX = 1
|