File: 129_functor.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 (46 lines) | stat: -rw-r--r-- 1,187 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
34
35
36
37
38
39
40
41
42
43
44
45
46
_interface "129_functor.smi"
functor F (
  A : sig
    type t
    val f : 'a -> t
  end
) =
struct
  fun f x = x
end
(*
2011-09-06 katsu

This causes an unexpected type error.

129_functor.sml:2.9-9.3 Error:
  (type inference 063-2) type and type annotation don't agree
    inferred type: ({1: 'C('RIGID(tv34))} -> {1: 'C('RIGID(tv34))})
                   -> ['a. 'a -> 'C('RIGID(tv34))] -> unit(t7[])
  type annotation: ({1: 'C('RIGID(tv34))} -> {1: 'C('RIGID(tv34))})
                   -> ['a. 'a -> 'C('RIGID(tv34))] -> unit(t7[])
*)


(*
2011-09-07 ohori

Fixed by the following refinemets.
1. added ICEXPORTFUNCTOR (var, ty, loc) for functor export decl.
2. In ICEXPORTFUNCTOR, ty and the actual functor term are eithr:
 1. TYPOLY(btvs, TYFUNM([first], TYFUNM(polyList, body)))
    ICFNM1([first], ICFNM1_POLY(polyPats, BODY))
 2. TYPOLY(btvs, TYFUNM([first], body))
    ICFNM1([first], BODY)
 3. TYFUNM(polyList, body)
    ICFNM1_POLY(polyPats, BODY)
 4. TYFUNM([unit], body)
    ICFNM1(UNIT, BODY)
 where body is either
    unit (TYCONSTRUCT ..) 
 or
   record (TYRECORD ..)
 BODY is ICLET(..., ICCONSTANT or ICRECORD)
InferType do case analysis and type check accordingly.

*)