mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-21 05:57:38 +03:00
b678d7c93c
Any name which would be a valid unbound implicit is now *always* an unbound implicit. This is much more resilient to changes in inputs, but does require that function names be explicitly qualified when in argument position. Updated libraries/tests accordingly. WARNING: This is likely to break some code; the fix is, in all cases, to give explicit namespaces for function names in types in an argument position (i.e. a valid position for it to be an unbound implicit).
48 lines
994 B
Idris
48 lines
994 B
Idris
module DSLPi
|
|
|
|
import Data.Fin
|
|
import Data.Vect
|
|
|
|
data Ty = BOOL | INT | UNIT | ARR Ty Ty
|
|
|
|
arr_ : _ -> Ty -> Ty -> Ty
|
|
arr_ _ = ARR
|
|
|
|
dsl simple_type
|
|
pi = arr_
|
|
|
|
test1 : simple_type (BOOL -> INT -> UNIT) = BOOL `ARR` (INT `ARR` UNIT)
|
|
test1 = Refl
|
|
|
|
using (vars : Vect n Ty)
|
|
infix 2 ===
|
|
|
|
data Expr : Vect n Ty -> Ty -> Type where
|
|
Var : (i : Fin n) -> Expr vars (index i vars)
|
|
(===) : Expr vars t -> Expr vars t -> Expr vars BOOL
|
|
|
|
data Spec : Vect n Ty -> Type where
|
|
ForAll : (t : Ty) -> Spec (t :: vars) -> Spec vars
|
|
ItHolds : Expr vars BOOL -> Spec vars
|
|
|
|
implicit exprSpec : Expr vars BOOL -> Spec vars
|
|
exprSpec = ItHolds
|
|
|
|
forall_ : _ -> (t : Ty) -> Spec (t :: vars) -> Spec vars
|
|
forall_ _ = ForAll
|
|
|
|
dsl specs
|
|
pi = forall_
|
|
variable = Var
|
|
index_first = FZ
|
|
index_next = FS
|
|
|
|
test2 : Spec []
|
|
test2 = specs ((x, y : INT) -> x === y)
|
|
|
|
test3 : Spec []
|
|
test3 = ForAll INT . ForAll INT . ItHolds $ Var (FS FZ) === Var FZ
|
|
|
|
test4 : DSLPi.test2 = DSLPi.test3
|
|
test4 = Refl
|