|
| 1 | +let func : HttpFunc = handler (Some >> Task.FromResult) |
| 2 | + |
| 3 | +type Base1() = |
| 4 | + abstract member F : unit -> unit |
| 5 | + default u.F() = |
| 6 | + printfn "F Base1" |
| 7 | + |
| 8 | +type Derived1() = |
| 9 | + inherit Base1() |
| 10 | + override u.F() = |
| 11 | + printfn "F Derived1" |
| 12 | + |
| 13 | +let d1 : Derived1 = Derived1() |
| 14 | + |
| 15 | +let base1 = d1 :> Base1 |
| 16 | +let derived1 = base1 :?> Derived1 |
| 17 | + |
| 18 | +type PersonName = |
| 19 | + | FirstOnly of string |
| 20 | + | LastOnly of string |
| 21 | + | FirstLast of string * string |
| 22 | + |
| 23 | +type Shape = |
| 24 | + | Rectangle of height : float * width : float |
| 25 | + | Circle of radius : float |
| 26 | + |
| 27 | +type MyInterface = |
| 28 | + abstract member Add: int -> int -> int |
| 29 | + abstract member Pi : float |
| 30 | + |
| 31 | +exception Error1 of string |
| 32 | +exception Error2 of string * int |
| 33 | + |
| 34 | +---------------------------------------------------- |
| 35 | + |
| 36 | +[ |
| 37 | + ["keyword", "let"], " func ", |
| 38 | + ["punctuation", ":"], ["class-name", ["HttpFunc"]], |
| 39 | + ["operator", "="], " handler ", ["punctuation", "("], |
| 40 | + "Some ", ["operator", ">>"], " Task", ["punctuation", "."], "FromResult", |
| 41 | + ["punctuation", ")"], |
| 42 | + |
| 43 | + ["keyword", "type"], ["class-name", ["Base1"]], ["punctuation", "("], ["punctuation", ")"], ["operator", "="], |
| 44 | + ["keyword", "abstract"], ["keyword", "member"], " F ", ["punctuation", ":"], |
| 45 | + ["class-name", [ |
| 46 | + "unit ", ["operator", "->"], " unit"] |
| 47 | + ], |
| 48 | + ["keyword", "default"], " u", ["punctuation", "."], ["function", "F"], ["punctuation", "("], ["punctuation", ")"], |
| 49 | + ["operator", "="], "\n printfn ", ["string", "\"F Base1\""], |
| 50 | + |
| 51 | + ["keyword", "type"], ["class-name", ["Derived1"]], ["punctuation", "("], ["punctuation", ")"], ["operator", "="], |
| 52 | + ["keyword", "inherit"], ["class-name", ["Base1"]], ["punctuation", "("], ["punctuation", ")"], |
| 53 | + ["keyword", "override"], " u", ["punctuation", "."], ["function", "F"], ["punctuation", "("], ["punctuation", ")"], ["operator", "="], |
| 54 | + "\n printfn ", ["string", "\"F Derived1\""], |
| 55 | + |
| 56 | + ["keyword", "let"], " d1 ", ["punctuation", ":"], ["class-name", ["Derived1"]], ["operator", "="], |
| 57 | + ["function", "Derived1"], ["punctuation", "("], ["punctuation", ")"], |
| 58 | + |
| 59 | + ["keyword", "let"], " base1 ", ["operator", "="], " d1 ", ["operator", ":>"], ["class-name", ["Base1"]], |
| 60 | + |
| 61 | + ["keyword", "let"], " derived1 ", ["operator", "="], " base1 ", ["operator", ":?>"], ["class-name", ["Derived1"]], |
| 62 | + |
| 63 | + ["keyword", "type"], ["class-name", ["PersonName"]], ["operator", "="], |
| 64 | + ["operator", "|"], " FirstOnly ", ["keyword", "of"], ["class-name", ["string"]], |
| 65 | + ["operator", "|"], " LastOnly ", ["keyword", "of"], ["class-name", ["string"]], |
| 66 | + ["operator", "|"], " FirstLast ", ["keyword", "of"], ["class-name", ["string ", ["operator", "*"], " string"]], |
| 67 | + |
| 68 | + ["keyword", "type"], ["class-name", ["Shape"]], ["operator", "="], |
| 69 | + ["operator", "|"], " Rectangle ", ["keyword", "of"], |
| 70 | + " height ", ["punctuation", ":"], ["class-name", ["float"]], ["operator", "*"], |
| 71 | + " width ", ["punctuation", ":"], ["class-name", ["float"]], |
| 72 | + ["operator", "|"], " Circle ", ["keyword", "of"], " radius ", ["punctuation", ":"], ["class-name", ["float"]], |
| 73 | + |
| 74 | + ["keyword", "type"], ["class-name", ["MyInterface"]], ["operator", "="], |
| 75 | + ["keyword", "abstract"], ["keyword", "member"], " Add", ["punctuation", ":"], |
| 76 | + ["class-name", ["int ", ["operator", "->"], " int ", ["operator", "->"], " int"]], |
| 77 | + ["keyword", "abstract"], ["keyword", "member"], " Pi ", ["punctuation", ":"], ["class-name", ["float"]], |
| 78 | + |
| 79 | + ["keyword", "exception"], ["class-name", ["Error1"]], ["keyword", "of"], ["class-name", ["string"]], |
| 80 | + |
| 81 | + ["keyword", "exception"], ["class-name", ["Error2"]], ["keyword", "of"], ["class-name", ["string ", ["operator", "*"], " int"]] |
| 82 | +] |
| 83 | + |
| 84 | +---------------------------------------------------- |
| 85 | + |
| 86 | +Checks for class-names. |
0 commit comments