Function types and literals

This commit is contained in:
Andrey Breslav
2010-11-15 16:57:00 +03:00
parent 6d6a22de1d
commit 3f6d1740ee
+33
View File
@@ -0,0 +1,33 @@
type f1 = {(T) : X}
// type f1 = {(T) => X}
type f2 = {(T, E) : X}
// type f2 = {(T, E) => X}
type f_tuple = {((T, E)) : X}
//type f_tuple = {((T, E)) => X}
type hof = { (X) : {(T) : Y} }
//type hof = { (X) => {(T) => Y} }
type hof2 = { {(X) : Y} : {(Y) : Z} }
//type hof2 = { {(X) => Y} => {(Y) => Z} }
type Comparison<in T> = {(a : T, b : T) : Int}
//type Comparison<in T> = {(a : T, b : T) => Int}
type Equality<in T> = {(a : T, b : T) : Boolean}
//type Equality<in T> = {(a : T, b : T) => Boolean}
type HashFunction<in T> = {(obj : T) : Int}
//type HashFunction<in T> = {(obj : T) => Int}
type Runnable = {() : ()}
//type Runnable = {() => ()}
type Function1<in T, out R> = {(input : T) : R}
//type Function1<in T, out R> = {(input : T) => R}
val f1 = {(t : T) : X => something(t)}
fun f1(t : T) : X = something(t)
val f1 = {(t : T) => something(t)}
val f1 = {t => something(t)}
val f1 = {something(it)}
val f1 : {(T) : X} = ...