<discocaml>
<xavierm02> I'd like to assert that a module `M` implements a signature `S` without restricting the public interface of the module to that signature. What's the standard way of doing this? The only way I can think of is applying a dummy functor `module F (X : S) = struct end` to `M`, but that's a bit ugly.
amk_ has joined #ocaml
amk has quit [Read error: Connection reset by peer]
amk_ is now known as amk
SquidDev has quit [Server closed connection]
SquidDev has joined #ocaml
<discocaml>
<peuk> Fixed, hope the PR will be accepted.
<discocaml>
<deepspacejohn> You can `include S` with the rest of its signature. https://ocaml.org/play#code=bW9kdWxlIHR5cGUgUyA9IHNpZwogIHR5cGUgdAogIHZhbCB6ZXJvOiB0CmVuZAoKbW9kdWxlIE06IHNpZwogIGluY2x1ZGUgUwogIHZhbCBpbmZpbml0eTogdAplbmQgPSBzdHJ1Y3QKICB0eXBlIHQgPSBmbG9hdAogIGxldCB6ZXJvID0gMC4wCiAgbGV0IGluZmluaXR5ID0gaW5maW5pdHkKZW5k
<discocaml>
<xavierm02> @deepspacejohn Yes of course. I was trying to avoid writing the whole signature.
waleee has joined #ocaml
<discocaml>
<deepspacejohn> You could also do `module M_check : S = M` which is similar to using a functor but simpler.
Serpent7776 has joined #ocaml
<discocaml>
<deepspacejohn> which will create a module `M_check` which has a restricted signature, but does not effect `M`
<discocaml>
<deepspacejohn> which will create a module `M_check` which has a restricted signature, but does not affect `M`
<discocaml>
<._null._> You don't have to give it a name even : `module _ : S = M` should work the same
<discocaml>
<smondet> you don't have to give it a name: `module _ : S = M`
<discocaml>
<deepspacejohn> oh yes, of course! I forget you can do that with modules.
<discocaml>
<smondet> but the initialization of M might be duplicated if you have side-effects
<discocaml>
<smondet> (or not because it is just a module alias …)
<discocaml>
<._null._> I don't know what module restriction can have as side-effects
<discocaml>
<deepspacejohn> restricting a signature usually initializes a new module, right? since the runtime representation of all modules with the same signature have to match.
<discocaml>
<smondet> it doesn't seem like it reruns in my case: ```
<discocaml>
<smondet> ocaml# module M = struct type t = int let () = print_endline "hello" end;;
<discocaml>
<smondet> hello
<discocaml>
<smondet> module M : sig type t = int end
<discocaml>
<smondet> ocaml# module _ : sig type t end = M;;
<discocaml>
<smondet> ocaml#
<discocaml>
<smondet> ```
<discocaml>
<xavierm02> Perfect! Thank you!
<discocaml>
<._null._> Apprently it copies the module moving around the pointers / immediates in its fields, but no initialisation (e.g. refs are shared)
<discocaml>
<deepspacejohn> That makes sense, considering that otherwise initialization would have to happen every time you apply a functor.
<discocaml>
<._null._> Initialisation does happen every time you apply a [generative] functor though
<discocaml>
<deepspacejohn> I mean to the functor arguments, since the runtime needs to restrict the input modules to fit the signatures.
<discocaml>
<._null._> Oh right, got you
<discocaml>
<smondet> There exists an older version of OCaml that reexuctes the side-effects.
<discocaml>
<smondet> this behavior comes from the "module aliases" feature
<discocaml>
<smondet> this behavior comes from the "module aliases" feature (I think)
Leonidas has quit [Quit: An ideal world is left as an exercise to the reader]
Leonidas has joined #ocaml
John_Ivan has joined #ocaml
<discocaml>
<regularspatula> Does anyone who use github CI with macOS find it to be sort of flaky with opam?
<zozozo>
@regularspatula : except for it taking more time than on linux, I haven't had much problems with macos in CI runs (contrary to windows)
<discocaml>
<Kali> you can view the progress of opam 2.2 here
<discocaml>
<Kali> you are welcome to help contribute
<discocaml>
<a.penumbra> I'm partially satisfied using the toolsuite by running it in a VM or WSL
<discocaml>
<a.penumbra> Just fully unsatisfied for not having it able to run with a win32 subsystem.
<discocaml>
<Kali> i found cygwin to be a convenient option, especially due to two facts: it does not require administrative rights, and you can use built binaries as-is outside of cygwin
<discocaml>
<a.penumbra> I uhm, use cygwin for something else.
<discocaml>
<a.penumbra> Offtopic: Man, how I wish there was selenium for bash.
<discocaml>
<a.penumbra> Or some sort of bash unit testing.
<discocaml>
<._null._> There's a channel for off-topic
<discocaml>
<Kali> #offtopic🎲
<discocaml>
<a.penumbra> Heading there now.
<discocaml>
<Kali> thanks
bartholin has joined #ocaml
<discocaml>
<regularspatula> fwiw, I manually reran the macOS job and it build fine
rf has joined #ocaml
rf has quit [Ping timeout: 240 seconds]
azimut has quit [Remote host closed the connection]
sim642 has quit [K-Lined]
azimut has joined #ocaml
alexherbo2 has joined #ocaml
Tuplanolla has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
alexherbo2 has quit [Remote host closed the connection]
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]