* [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
@ 2014-04-27 12:52 Berke Durak
2014-04-27 13:18 ` Yaron Minsky
2014-05-03 20:18 ` Richard W.M. Jones
0 siblings, 2 replies; 13+ messages in thread
From: Berke Durak @ 2014-04-27 12:52 UTC (permalink / raw)
To: caml-list
What happened?
OCaml version 4.02.0+dev4-2014-04-03
# module S = String;;
module S = String
--
Berke Durak
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 12:52 [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature Berke Durak
@ 2014-04-27 13:18 ` Yaron Minsky
2014-04-27 13:45 ` Berke Durak
2014-04-27 14:04 ` Malcolm Matalka
2014-05-03 20:18 ` Richard W.M. Jones
1 sibling, 2 replies; 13+ messages in thread
From: Yaron Minsky @ 2014-04-27 13:18 UTC (permalink / raw)
To: Berke Durak; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
Sends preferable behavior to me, since it avoid overly long signatures and
more clearly reflects the new semantics of module aliases.
But it might be nice to have a way to see the contents of a module in the
toplevel. Maybe steak the #typeof declaration from utop?
y
On Apr 27, 2014 8:47 AM, "Berke Durak" <berke.durak@gmail.com> wrote:
> What happened?
>
> OCaml version 4.02.0+dev4-2014-04-03
>
> # module S = String;;
> module S = String
>
> --
> Berke Durak
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
[-- Attachment #2: Type: text/html, Size: 1253 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 13:18 ` Yaron Minsky
@ 2014-04-27 13:45 ` Berke Durak
2014-04-27 13:58 ` ygrek
2014-04-27 14:34 ` Leo White
2014-04-27 14:04 ` Malcolm Matalka
1 sibling, 2 replies; 13+ messages in thread
From: Berke Durak @ 2014-04-27 13:45 UTC (permalink / raw)
To: caml-list
On Sun, Apr 27, 2014 at 09:18:26AM -0400, Yaron Minsky wrote:
> Sends preferable behavior to me, since it avoid overly long signatures and
> more clearly reflects the new semantics of module aliases.
If that's the issue, when the toplevel is connected to a tty, it should cut the
output at some point and put an ellipsis. If it's not a tty, it should still
blast the full signature.
I'm surely not the only one who has been relying on module X = Blah to see the
signature of a module. Old habits die hard.
Also module SM = Map.Make(String) still prints the full declaration.
> But it might be nice to have a way to see the contents of a module in the
> toplevel. Maybe steak the #typeof declaration from utop?
How does one print a module signature in utop?
--
Berke Durak
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 13:45 ` Berke Durak
@ 2014-04-27 13:58 ` ygrek
2014-04-27 14:19 ` Berke Durak
2014-04-27 14:34 ` Leo White
1 sibling, 1 reply; 13+ messages in thread
From: ygrek @ 2014-04-27 13:58 UTC (permalink / raw)
To: caml-list
There should be #show directive
See http://caml.inria.fr/mantis/view.php?id=5377
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 13:18 ` Yaron Minsky
2014-04-27 13:45 ` Berke Durak
@ 2014-04-27 14:04 ` Malcolm Matalka
1 sibling, 0 replies; 13+ messages in thread
From: Malcolm Matalka @ 2014-04-27 14:04 UTC (permalink / raw)
To: Yaron Minsky; +Cc: Berke Durak, caml-list
I make use of this trick often instead of going to documentation, it's
pretty convenient.
Yaron Minsky <yminsky@janestreet.com> writes:
> Sends preferable behavior to me, since it avoid overly long signatures and
> more clearly reflects the new semantics of module aliases.
>
> But it might be nice to have a way to see the contents of a module in the
> toplevel. Maybe steak the #typeof declaration from utop?
>
> y
> On Apr 27, 2014 8:47 AM, "Berke Durak" <berke.durak@gmail.com> wrote:
>
>> What happened?
>>
>> OCaml version 4.02.0+dev4-2014-04-03
>>
>> # module S = String;;
>> module S = String
>>
>> --
>> Berke Durak
>>
>> --
>> Caml-list mailing list. Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 13:58 ` ygrek
@ 2014-04-27 14:19 ` Berke Durak
2014-04-27 14:21 ` Daniel Bünzli
0 siblings, 1 reply; 13+ messages in thread
From: Berke Durak @ 2014-04-27 14:19 UTC (permalink / raw)
To: caml-list
On Sun, Apr 27, 2014 at 09:58:47PM +0800, ygrek wrote:
>
> There should be #show directive
> See http://caml.inria.fr/mantis/view.php?id=5377
Thanks! That looks nice.
I don't see a #help directive; that should be added as well.
--
Berke Durak
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 14:19 ` Berke Durak
@ 2014-04-27 14:21 ` Daniel Bünzli
2014-04-27 14:59 ` Berke Durak
0 siblings, 1 reply; 13+ messages in thread
From: Daniel Bünzli @ 2014-04-27 14:21 UTC (permalink / raw)
To: Berke Durak; +Cc: caml-list
Le dimanche, 27 avril 2014 à 16:19, Berke Durak a écrit :
> I don't see a #help directive; that should be added as well.
File in bugs if you want these things to happen.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 13:45 ` Berke Durak
2014-04-27 13:58 ` ygrek
@ 2014-04-27 14:34 ` Leo White
2014-04-27 15:02 ` Berke Durak
1 sibling, 1 reply; 13+ messages in thread
From: Leo White @ 2014-04-27 14:34 UTC (permalink / raw)
To: Berke Durak; +Cc: caml-list
The semantics of module aliases has changed in 4.02, so now:
module S = String
creates a proper alias to String. This means, for example, that the type
`Map.Make(String).t` is now equivalent to `Map.Make(S).t`:
OCaml version 4.02.0+dev4-2014-04-03
# module S = String;;
module S = String
# let f (x : 'a Map.Make(String).t) : 'a Map.Make(S).t = x;;
val f : 'a Map.Make(String).t -> 'a Map.Make(S).t = <fun>
where as previously:
OCaml version 4.01.0
# module S = String;;
module S :
sig
[...]
end
# let f (x : 'a Map.Make(String).t) : 'a Map.Make(S).t = x;;
Characters 55-56:
let f (x : 'a Map.Make(String).t) : 'a Map.Make(S).t = x;;
^
Error: This expression has type 'a Map.Make(String).t
but an expression was expected of type 'a Map.Make(S).t
In order to expose such aliases in signatures, you can now write `module
S = String` in signatures as well as structures. This is why the output
from the top-level has changed: it is still printing the type of `S`,
but `S` now has type `= String`.
To help people who previously defined aliases to print a module's
contents, the `#show` directive has been added to the top-level:
# #show module String;;
module String :
sig
[...]
end
Regards,
Leo
Berke Durak <berke.durak@gmail.com> writes:
> On Sun, Apr 27, 2014 at 09:18:26AM -0400, Yaron Minsky wrote:
>> Sends preferable behavior to me, since it avoid overly long signatures and
>> more clearly reflects the new semantics of module aliases.
>
> If that's the issue, when the toplevel is connected to a tty, it should cut the
> output at some point and put an ellipsis. If it's not a tty, it should still
> blast the full signature.
>
> I'm surely not the only one who has been relying on module X = Blah to see the
> signature of a module. Old habits die hard.
>
> Also module SM = Map.Make(String) still prints the full declaration.
>
>> But it might be nice to have a way to see the contents of a module in the
>> toplevel. Maybe steak the #typeof declaration from utop?
>
> How does one print a module signature in utop?
>
> --
> Berke Durak
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 14:21 ` Daniel Bünzli
@ 2014-04-27 14:59 ` Berke Durak
0 siblings, 0 replies; 13+ messages in thread
From: Berke Durak @ 2014-04-27 14:59 UTC (permalink / raw)
To: Daniel Bünzli; +Cc: caml-list
On Sun, Apr 27, 2014 at 04:21:19PM +0200, Daniel Bünzli wrote:
> Le dimanche, 27 avril 2014 à 16:19, Berke Durak a écrit :
> > I don't see a #help directive; that should be added as well.
>
> File in bugs if you want these things to happen.
It was a pending feature request with a (slightly buggy) patch.
I wrote a small patch before checking if one existed.
http://caml.inria.fr/mantis/view.php?id=6113
--
Berke Durak
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 14:34 ` Leo White
@ 2014-04-27 15:02 ` Berke Durak
0 siblings, 0 replies; 13+ messages in thread
From: Berke Durak @ 2014-04-27 15:02 UTC (permalink / raw)
To: caml-list
On Sun, Apr 27, 2014 at 03:34:48PM +0100, Leo White wrote:
> The semantics of module aliases has changed in 4.02, so now:
Thanks for the detailed explanation, Leo.
> To help people who previously defined aliases to print a module's
> contents, the `#show` directive has been added to the top-level:
>
> # #show module String;;
> module String :
> sig
> [...]
> end
Hence the need for toplevel #help
--
Berke Durak
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-04-27 12:52 [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature Berke Durak
2014-04-27 13:18 ` Yaron Minsky
@ 2014-05-03 20:18 ` Richard W.M. Jones
2014-05-03 20:21 ` Anil Madhavapeddy
1 sibling, 1 reply; 13+ messages in thread
From: Richard W.M. Jones @ 2014-05-03 20:18 UTC (permalink / raw)
To: Berke Durak; +Cc: caml-list
More to the point, was this OCaml 4.02 dev pre-release announced anywhere?
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-05-03 20:18 ` Richard W.M. Jones
@ 2014-05-03 20:21 ` Anil Madhavapeddy
2014-05-03 22:00 ` Richard W.M. Jones
0 siblings, 1 reply; 13+ messages in thread
From: Anil Madhavapeddy @ 2014-05-03 20:21 UTC (permalink / raw)
To: Richard W.M. Jones; +Cc: Berke Durak, caml-list
On 3 May 2014, at 21:18, Richard W.M. Jones <rich@annexia.org> wrote:
>
> More to the point, was this OCaml 4.02 dev pre-release announced anywhere?
>
This is just a trunk snapshot of OCaml, as obtained via `opam switch 4.02.0dev+trunk`.
-anil
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature
2014-05-03 20:21 ` Anil Madhavapeddy
@ 2014-05-03 22:00 ` Richard W.M. Jones
0 siblings, 0 replies; 13+ messages in thread
From: Richard W.M. Jones @ 2014-05-03 22:00 UTC (permalink / raw)
To: Anil Madhavapeddy; +Cc: Berke Durak, caml-list
On Sat, May 03, 2014 at 09:21:13PM +0100, Anil Madhavapeddy wrote:
> On 3 May 2014, at 21:18, Richard W.M. Jones <rich@annexia.org> wrote:
> >
> > More to the point, was this OCaml 4.02 dev pre-release announced anywhere?
> >
>
> This is just a trunk snapshot of OCaml, as obtained via `opam switch 4.02.0dev+trunk`.
Ah I see, that explains why I didn't see an announcement.
Thanks,
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-05-03 22:00 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-27 12:52 [Caml-list] Ocaml 4.02.0+dev4-2014-04-03 toplevel: module aliases no longer print module signature Berke Durak
2014-04-27 13:18 ` Yaron Minsky
2014-04-27 13:45 ` Berke Durak
2014-04-27 13:58 ` ygrek
2014-04-27 14:19 ` Berke Durak
2014-04-27 14:21 ` Daniel Bünzli
2014-04-27 14:59 ` Berke Durak
2014-04-27 14:34 ` Leo White
2014-04-27 15:02 ` Berke Durak
2014-04-27 14:04 ` Malcolm Matalka
2014-05-03 20:18 ` Richard W.M. Jones
2014-05-03 20:21 ` Anil Madhavapeddy
2014-05-03 22:00 ` Richard W.M. Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox