Idris2/tests/idris2/operators/operators001/Test.idr

32 lines
583 B
Idris
Raw Normal View History

2023-10-18 14:06:36 +03:00
2023-10-21 16:28:17 +03:00
import Data.Vect
typebind infixr 0 =@
2023-10-18 14:06:36 +03:00
2023-10-18 15:04:42 +03:00
0 (=@) : (a : Type) -> (a -> Type) -> Type
2023-10-18 14:06:36 +03:00
(=@) a f = (1 x : a) -> f x
2023-10-21 16:28:17 +03:00
data S : {ty : Type} -> (x : ty) -> Type where
MkS : (x : ty) =@ S x
typebind infixr 0 *>
-- (*>) : (ty : Type) -> (ty -> Type) -> Type
-- (*>) = DPair
--
-- testCompose : (x : Nat) *> (y : Nat) *> Vect (n + m) String
-- testCompose = (1 ** 2 ** ["hello", "world", "!"])
autobind infixr 7 `MyLet`
MyLet : (val) -> (val -> rest) -> rest
MyLet arg fn = fn arg
program : Nat
program = (n := 3) `MyLet` 2 + n
2023-10-21 16:28:17 +03:00
program2 : Nat
program2 = (n : Nat := 3) `MyLet` 2 + n