-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
61 lines (51 loc) · 1.76 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="index.css">
<title>HM<sup>ℓ</sup> demonstration</title>
</head>
<body>
<h1>HM<sup>ℓ</sup> demonstration</h1>
<div id="content">
<textarea id="system-input" class="panel" spellcheck="false">
(* example 1 - tuple field types mismatch *)
val parse_version: string -> string
val show_major: string -> string
let appInfo = ("My Application", 1.5)
let process (name, vers) = name ^ show_major (parse_version vers)
let test = process appInfo
(* example 2 - let polymorphism is allowed *)
let letpoly =
let f x = x in
(f 1, f true)
(* example 3 - match case arms return different values *)
type ('a, 'b) either = Left of 'a | Right of 'b
let destructEither x = match x with
| Left l -> l + 1
| Right r -> r :: []
</textarea>
<div id="system-output" class="panel"></div>
</div>
<script type="text/javascript" src="bin/mlscript-opt.js"></script>
<br />
<p>
This is a demo of the HM<sup>ℓ</sup> type system. Code on the left panel is type checked
and on the left panel valid types and type unification errors are shown.
</p>
<p>
The demo implements a frontend for OCaml syntax.
It supports type declaration, ADT definition, top level let statements,
and pattern matching. Note that it does not support
list/string indexing, records nested pattern matching and modules.
</p>
<p>
Some basic standard library functions for booleans, strings, lists, integers
are pre-defined. We provide slightly relaxed OCaml syntax for declaring
function signatures as needed.
</p>
<p>
Some examples from the manuscript might report slightly different
errors here because of changed formatting and layout design.
</p>
</html>