-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathhaskell-equality-table.html
126 lines (121 loc) · 19.3 KB
/
haskell-equality-table.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<head>
<title>Haskell equality table</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
table#eq {
padding-top: 4.5em;
}
table#eq tr:first-child th {
max-width: 1em;
transform: rotate(-90deg);
transform-origin: 43% 32%;
}
table#eq tr th.l {
text-align: right;
padding-right: 0.5em;
}
table#eq tr th {
white-space: pre;
font-weight: normal;
font-family: monospace;
}
table#eq tr:first-child th a {
display: block;
}
th {
font-weight: bold;
text-align: left;
}
.cell {
height: 1.2em;
width: 1.2em;
border-radius: 3px;
border-width: 2px;
border-style: solid;
text-align: center;
}
.true {
background-color: #8fcf70;
border-color: #599f35;
}
.true:before { content: "="; }
.false {
background-color: #e0a2a1;
border-color: #c14746;
}
.false:before { content: "≠"; }
.typeError {
background-color: #eee;
border-color: #ccc;
}
.ambiguousErrorT {
background-color: #eee;
border-color: #599f35;
}
.ambiguousErrorF {
background-color: #eee;
border-color: #c14746;
}
a {
color: #333;
text-decoration: none;
border-bottom: 1px dotted #333;
}
a:hover {
color: #c14746;
border-bottom: 1px solid #c14746;
}
code {
white-space: pre;
}
</style>
</head>
<body>
<h1>Haskell equality table</h1>
<table id="eq">
<tr> <td/> <th class="t">True</th> <th class="t">False</th> <th class="t">1 :: Int</th> <th class="t">0 :: Int</th> <th class="t">-1 :: Int</th> <th class="t">1 :: Double</th> <th class="t">0 :: Double</th> <th class="t">-1 :: Double</th> <th class="t">Infinity</th> <th class="t">-Infinity</th> <th class="t">NaN</th> <th class="t">"True"</th> <th class="t">"False"</th> <th class="t">"1"</th> <th class="t">"0"</th> <th class="t">"-1"</th> <th class="t">""</th> <th class="t">[]</th> <th class="t">[[]]</th> <th class="t">[0 :: Int]</th> <th class="t">[1 :: Int]</th> </tr>
<tr> <th class="l">True</th> <td class="cell true"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">False</th> <td class="cell false"/> <td class="cell true"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">1 :: Int</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">0 :: Int</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">-1 :: Int</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">1 :: Double</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">0 :: Double</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">-1 :: Double</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">Infinity</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">-Infinity</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">NaN</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">"True"</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">"False"</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">"1"</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">"0"</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">"-1"</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell false"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">""</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell true"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">[]</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell false"/> <td class="cell true"/> <td class="cell ambiguousErrorT"/> <td class="cell ambiguousErrorF"/> <td class="cell false"/> <td class="cell false"/> </tr>
<tr> <th class="l">[[]]</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell ambiguousErrorF"/> <td class="cell ambiguousErrorT"/> <td class="cell typeError"/> <td class="cell typeError"/> </tr>
<tr> <th class="l">[0 :: Int]</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell true"/> <td class="cell false"/> </tr>
<tr> <th class="l">[1 :: Int]</th> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell typeError"/> <td class="cell false"/> <td class="cell true"/> </tr>
</table>
<h2>Legend</h2>
<table>
<tr> <td class="cell true"/> <td>x == y ↠ True </td> </tr>
<tr> <td class="cell false"/> <td>x == y ↠ False</td> </tr>
<tr> <td class="cell typeError"/> <td>Type error (mismatched types)</td> </tr>
<tr> <td class="cell ambiguousErrorT"/> <td>Type error (ambiguous type, requires explicit type annotation, True once ambiguity is resolved)</td> </tr>
<tr> <td class="cell ambiguousErrorF"/> <td>Type error (ambiguous type, requires explicit type annotation, False once ambiguity is resolved)</td> </tr>
</table>
<h2>Explanation of special cases</h2>
<ul>
<li><code>NaN</code> is unequal to itself according to the <a href="https://en.wikipedia.org/wiki/IEEE_754">floating point standard</a>.</li>
<li><code>""</code> is identical to <code>[] :: [Char]</code>, so they are
equal.</li>
<li><code>[]</code> cannot be compared to itself directly, because the
concrete type of the contained values is unknown, and the right
<code>Eq</code> instance cannot be found. Adding explicit type
annotations solves this issue, <code>([] :: [Int]) == []</code> is
<code>True</code>. (Note that GHCi has extended default rules, picking
<code>[] :: [()]</code> to make this sort of ambiguity somewhat easier
to work with in the REPL meant for fast one-liners.)</li>
</ul>
</body>