mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-27 13:43:28 +03:00
9f39ad6ba8
Previously, parameter block reused the same syntax as in Idris1: ``` parameters (v1 : t1, … , vn : tn) ``` Unfortunately this syntax presents some issues: - It does not allow to declare implicit parameters - It does not allow to specify which multiplicity to use - It is inconsistent with the syntax used for named arguments elsewhere in the language. This change fixes those three problems by borrowing the syntax for declaring type parameters in records: ``` parameters (v1 : t2) (v2 : t2) … (vn : tn) ``` It also enables other features like multiple declarations of arguments with the same type: ``` parameters (v1, v2 : Type) ```
14 lines
288 B
Idris
14 lines
288 B
Idris
parameters {n : Nat}
|
|
(a : Int)
|
|
0 func : Bool -> Type
|
|
func True = List Bool
|
|
func False = List Nat
|
|
|
|
getType : (b : Bool) -> func b
|
|
getType False = [0,1,2]
|
|
getType True = [True, True, True]
|
|
|
|
prf : (b : Bool) -> Int -> func b
|
|
prf b i = let i1 = getType b in ?whut
|
|
|