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
Here is another proposal that tries to relate to existing fragments of the language :
let f (type a) (type b) (a:a) (b:b) = ...
let f (type a) = fun (a:a) -> ...
let f = function
| A (type a) (a:a) ->
(module (struct
type a = a
let a = a
end) : S)
as in the existing examples, the (type $id)* is placed between the function name and the arguments, where here it is between the constructor name and the arguments
Original bug ID: 5867
Reporter: mbarbin
Assigned to: @garrigue
Status: closed (set by @alainfrisch on 2015-12-07T08:55:56Z)
Resolution: duplicate
Severity: feature
Version: 4.00.1
Category: typing
Duplicate of: #7074
Child of: #5998
Monitored by: @gasche "Julien Signoles" @hcarty @alainfrisch
Bug description
(* Given these two ways of encoding an existential type *)
type t = A : 'a -> t
module type S = sig
type a
val a : a
end
(* one can easily go from one to the other *)
let to_gadt (module S : S) = A S.a
(* however, the other way around lacks of a syntax to name the ex#i type: *)
let f = function
| A a ->
(fun (type aa) (a:aa) ->
(module (struct
type a = aa
let a = a
end) : S)
) a
(* since the scope of 'a would be the entire function the following does not work and complain that the type ex#i would escape its scope *)
let f = function
| A (a:'a) ->
(module (struct
type a = 'a
let a = a
end) : S)
The text was updated successfully, but these errors were encountered: