forked from hkust-taco/mlscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
43 lines (37 loc) · 1.19 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="index.css">
<title>MLscript demonstration</title>
</head>
<body>
<h1>ML<sub>script</sub> online demonstration</h1>
<div id="content">
<textarea id="mlscript-input" class="panel" spellcheck="false">
class Left[A]: { value: A }
def Left value = Left{ value }
class Right[A]: { value: A }
def Right value = Right{ value }
def test x = case x of
{ Left -> x.value
| Right -> "nope"
}
def tmp = test (if true then Left 1 else Right 2)
case tmp of { int -> tmp | string -> 0 }
def f: (int & 'a) -> (int & 'a) -> 'a
def f a b = if gt a b then a else b
f 1 2
</textarea>
<!-- let rec recursive_monster = fun x ->
{ thing = x;
self = recursive_monster x } -->
<div id="mlscript-output" class="panel"></div>
</div>
<script type="text/javascript" src="bin/mlscript-opt.js"></script>
<br/>
<p>The code is available <a href="https://github.com/hkust-taco/mlscript">on github</a>.</p>
<br/>
<p>Note: JavaScript code generation (used to evaluate the result) is not perfect yet and has rough edges.
Also, try typing `window.alert "Hello!"` and see what happens!</p>
</html>