File: equality-types.sml

package info (click to toggle)
mlton 20100608-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 34,980 kB
  • ctags: 69,089
  • sloc: ansic: 18,421; lisp: 2,879; makefile: 1,570; sh: 1,325; pascal: 256; asm: 97
file content (40 lines) | stat: -rw-r--r-- 605 bytes parent folder | download | duplicates (8)
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
val _ = 1 = 2

val _ = 1.0 = 2.0 (* error *)

val f: ''a -> unit = fn _ => raise Fail "f"

val _ = f 1

val _ = f 1.0 (* error *)

datatype 'a t = T of 'a

val _ = T 1 = T 2

val _ = T 1.0 = T 2.0 (* 15 error *)

datatype 'a t = T

val _ = (T: int t) = T
   
val _ = (T: real t) = T (* 21 error *)

datatype t = T of u
withtype u = real

val _ = T 13.0 = T 14.0 (* 26 error *)

datatype t = T of u
and u = U of t

fun f (x: t) = x = x

datatype 'a t = T of 'a u
and 'a u = U of 'a

fun f (x: int t) = x = x

fun f (x: real t) = x = x (* 38 error *)

val f: 'a -> unit = fn x => (x = x; ()) (* 40 error *)