From 3f6d1740eefacd72b4e2b5d22a40b21cf87e9e35 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Mon, 15 Nov 2010 16:57:00 +0300 Subject: [PATCH] Function types and literals --- examples/src/FunctionsAndTypes.jetl | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/src/FunctionsAndTypes.jetl diff --git a/examples/src/FunctionsAndTypes.jetl b/examples/src/FunctionsAndTypes.jetl new file mode 100644 index 00000000000..543a1f6475f --- /dev/null +++ b/examples/src/FunctionsAndTypes.jetl @@ -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 = {(a : T, b : T) : Int} +//type Comparison = {(a : T, b : T) => Int} +type Equality = {(a : T, b : T) : Boolean} +//type Equality = {(a : T, b : T) => Boolean} +type HashFunction = {(obj : T) : Int} +//type HashFunction = {(obj : T) => Int} +type Runnable = {() : ()} +//type Runnable = {() => ()} +type Function1 = {(input : T) : R} +//type Function1 = {(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} = ... +