module MJ.Types where

open import Prelude hiding (_≟_)
open import Data.Fin.Properties as FinP using ()
open import Data.Vec
open import Data.List

open import Relation.Binary.Core
open import Relation.Nullary

data Cid (c : ) : Set where
  cls : Fin c  Cid c
  Object : Cid c

_cid≟_ :  {c}  Decidable (_≡_ {A = Cid c})
cls x cid≟ cls y with x FinP.≟ y
cls x cid≟ cls .x | yes refl = yes refl
cls x cid≟ cls y | no ¬p = no (λ{ refl  ¬p refl})
cls x cid≟ Object = no  ())
Object cid≟ cls x = no  ())
Object cid≟ Object = yes refl

data Ty (c : ) : Set where
  void : Ty c
  int  : Ty c
  ref  : Cid c  Ty c

data Ty⁺ (c : ) : Set where
  vty : Ty c  Ty⁺ c
  obj : Cid c  Ty⁺ c

World :   Set
World c = List (Ty⁺ c)

Sig :   Set
Sig c = List (Ty c) × Ty c

_≟_ :  {c}  Decidable (_≡_ {A = Ty c})
void  void = yes refl
void  int = no  ())
void  ref x = no  ())
int  void = no  ())
int  int = yes refl
int  ref x = no  ())
ref x  void = no  ())
ref x  int = no  ())
ref x  ref y with x cid≟ y
ref x  ref y | yes p = yes (cong ref p)
ref x  ref y | no ¬p = no λ{ refl  ¬p refl }