You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, radius is considered a distinct type from int.
The same module in OCaml compiles just fine:
typeradius = inttypeshape = Circleofradiusletmake_circler=Circle r
lettest_circle()= make_circle 1
I think it makes sense for MLFE to behave the same way.
If I would like to make the radius type abstract (or opaque in dialyzer terms), I would hide it in a module (example in OCaml):
moduleRadius : sigtyperadiusvalmake_radius: int -> radiusend=structtyperadius = intletmake_radiusi= i
endtypeshape = CircleofRadius.radiusletmake_circler=Circle r
lettest_circle()= make_circle (Radius.make_radius 1)
To achieve the same in MLFE, types should be module local by default, and you would have to export them via a export_type directive or similar. We would also need to be able to mark types as abstract. In Erlang/Dialyzer this is achieved by using the -opaque directive.
The text was updated successfully, but these errors were encountered:
Consider the following example:
This unexpectedly fails to typecheck with the error:
That is,
radius
is considered a distinct type fromint
.The same module in OCaml compiles just fine:
I think it makes sense for MLFE to behave the same way.
If I would like to make the radius type abstract (or opaque in dialyzer terms), I would hide it in a module (example in OCaml):
To achieve the same in MLFE, types should be module local by default, and you would have to export them via a
export_type
directive or similar. We would also need to be able to mark types as abstract. In Erlang/Dialyzer this is achieved by using the-opaque
directive.The text was updated successfully, but these errors were encountered: