Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#184] Difference between mlton/sml-nj in type generalization

Date:
2017-06-11 13:28
Priority:
3
State:
Open
Submitted by:
Bug Submitter (webuser)
Assigned to:
Nobody (None)
Machine Architecture:
None
Operating System:
Generic Unix
Component:
Compiler
Resolution:
None
Severity:
Cosmetic
OS Version:
SML/NJ Version:
110.81
Keywords:
URL:
Transcript (of reproduction):
Standard ML of New Jersey v110.81 [built: Sun Jun 11 05:04:27 2017] [opening silly.sml] val id = fn : 'a -> 'a val curry = fn : ('a * 'b -> 'c) -> 'a -> 'b -> 'c val foo = fn : int * (bool * (unit * real)) -> unit silly.sml:6.5-6.20 Warning: type vars not generalized because of value restriction are instantiated to dummy types (X1,X2,...) silly.sml:7.11-7.19 Error: operator and operand don't agree [tycon mismatch] operator domain: 'Z * 'Y -> 'X operand: ?.X1 -> int * ?.X1 in expression: curry it
Source (for reproduction):
fun id x = x fun curry f x y = f (x, y) fun foo (w : int, (x : bool, (y : unit, z : real))) = (); val it = curry id 0 val it = (curry it) true val it = (curry it) () val it = it 0.0 val _ = foo it;
Summary:
Difference between mlton/sml-nj in type generalization

Detailed description
In a silly example there is an observable difference between SML/NJ and MLton,
SML/NJ rejects the code, while MLTon accepts it,

I'm not quite sure though one or both may conform to the standard,
with differing interpretations of the value restriction context.


Additional comments:
Perhaps everything is conforming and this can be closed without change.
I just figured I would point it out.

Submitted via web form by matt rice <ratmice@gmail.com>

Comments:

No Comments Have Been Posted

Attached Files:

Changes

No Changes Have Been Made to This Item