File: 195_dummyType.sml

package info (click to toggle)
smlsharp 4.1.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 123,724 kB
  • sloc: ansic: 16,725; sh: 4,347; makefile: 2,191; java: 742; haskell: 493; ruby: 305; cpp: 284; pascal: 256; ml: 255; lisp: 141; asm: 97; sql: 74
file content (33 lines) | stat: -rw-r--r-- 969 bytes parent folder | download | duplicates (3)
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
fun id x = x;
val f2 = fn (x : 'a) => fn y => (x, y);
val fPolyVar12 = f2 id;
val xPolyVar12 = fPolyVar12 1;

(*
2012-05-18 katsu

When the above input is inputed to the interactive mode, warning of dummy
type is caused twice.

# fun id x = x;
val id = _ : ['a. 'a -> 'a]
# val f2 = fn (x : 'a) => fn y => (x, y);
val f2 = _ : ['a. 'a -> ['b. 'b -> 'a * 'b]]
# val fPolyVar12 = f2 id;
(BuiltinContext.smi):43.11-43.14 Warning:
 (type inference 065) dummy type variable(s) are introduced due to value
 restriction in: fPolyVar12
val fPolyVar12 = _ : ['a. 'a -> (?X1 -> ?X1) * 'a]
# val xPolyVar12 = fPolyVar12 1;
(BuiltinContext.smi):43.11-43.14 Warning:
 (type inference 065) dummy type variable(s) are introduced due to value
 restriction in: xPolyVar12
val xPolyVar12 = (fn, 1) : (?X1 -> ?X1) * int

(***** ^^ The second warning should not be caused since the dummy type
variable ?X1 is already introduced *****)

*)
(*
2012-07-11 ohori fixed by 4300:a624ccfe0bc7
*)