mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-22 06:29:37 +03:00
Fix samples to use Type instead of Set
This commit is contained in:
parent
95607a59c7
commit
4a15c64812
@ -1,6 +1,6 @@
|
||||
module main
|
||||
|
||||
data Bit : Nat -> Set where
|
||||
data Bit : Nat -> Type where
|
||||
b0 : Bit 0
|
||||
b1 : Bit 1
|
||||
|
||||
@ -10,7 +10,7 @@ instance Show (Bit n) where
|
||||
|
||||
infixl 5 #
|
||||
|
||||
data Binary : (width : Nat) -> (value : Nat) -> Set where
|
||||
data Binary : (width : Nat) -> (value : Nat) -> Type where
|
||||
zero : Binary O O
|
||||
(#) : Binary w v -> Bit bit -> Binary (S w) (bit + 2 * v)
|
||||
|
||||
|
@ -2,18 +2,18 @@ module main
|
||||
|
||||
data Ty = TyInt | TyBool| TyFun Ty Ty
|
||||
|
||||
interpTy : Ty -> Set
|
||||
interpTy : Ty -> Type
|
||||
interpTy TyInt = Int
|
||||
interpTy TyBool = Bool
|
||||
interpTy (TyFun s t) = interpTy s -> interpTy t
|
||||
|
||||
using (G : Vect Ty n)
|
||||
|
||||
data Env : Vect Ty n -> Set where
|
||||
data Env : Vect Ty n -> Type where
|
||||
Nil : Env Nil
|
||||
(::) : interpTy a -> Env G -> Env (a :: G)
|
||||
|
||||
-- data HasType : (i : Fin n) -> Vect Ty n -> Ty -> Set where
|
||||
-- data HasType : (i : Fin n) -> Vect Ty n -> Ty -> Type where
|
||||
-- stop : HasType fO (t :: G) t
|
||||
-- pop : HasType k G t -> HasType (fS k) (u :: G) t
|
||||
|
||||
@ -21,7 +21,7 @@ using (G : Vect Ty n)
|
||||
lookup fO (x :: xs) = x
|
||||
lookup (fS i) (x :: xs) = lookup i xs
|
||||
|
||||
data Expr : Vect Ty n -> Ty -> Set where
|
||||
data Expr : Vect Ty n -> Ty -> Type where
|
||||
Var : (i : Fin n) -> Expr G (lookup i G)
|
||||
Val : (x : Int) -> Expr G TyInt
|
||||
Lam : Expr (a :: G) t -> Expr G (TyFun a t)
|
||||
|
@ -2,18 +2,18 @@ module main
|
||||
|
||||
data Ty = TyInt | TyBool | TyFun Ty Ty
|
||||
|
||||
interpTy : Ty -> Set
|
||||
interpTy : Ty -> Type
|
||||
interpTy TyInt = Int
|
||||
interpTy TyBool = Bool
|
||||
interpTy (TyFun s t) = interpTy s -> interpTy t
|
||||
|
||||
using (G : Vect Ty n)
|
||||
|
||||
data Env : Vect Ty n -> Set where
|
||||
data Env : Vect Ty n -> Type where
|
||||
Nil : Env Nil
|
||||
(::) : interpTy a -> Env G -> Env (a :: G)
|
||||
|
||||
data HasType : (i : Fin n) -> Vect Ty n -> Ty -> Set where
|
||||
data HasType : (i : Fin n) -> Vect Ty n -> Ty -> Type where
|
||||
stop : HasType fO (t :: G) t
|
||||
pop : HasType k G t -> HasType (fS k) (u :: G) t
|
||||
|
||||
@ -21,7 +21,7 @@ using (G : Vect Ty n)
|
||||
lookup stop (x :: xs) = x
|
||||
lookup (pop k) (x :: xs) = lookup k xs
|
||||
|
||||
data Expr : Vect Ty n -> Ty -> Set where
|
||||
data Expr : Vect Ty n -> Ty -> Type where
|
||||
Var : HasType i G t -> Expr G t
|
||||
Val : (x : Int) -> Expr G TyInt
|
||||
Lam : Expr (a :: G) t -> Expr G (TyFun a t)
|
||||
|
Loading…
Reference in New Issue
Block a user