<AxiomaticEspress>
Is there any way to reload modules inside utop? Or even have like watch files options that does it for me when files change. I'm using dune. Thanks :)
<AxiomaticEspress>
I see is possible to do `dune utop --watch` but it doesn't seem to work.
<cemerick>
companion_cube: I suppose that makes sense. I (still) don't see that one form is more essential than the other, thus the question.
<companion_cube>
`functor` is more canonical, I guess, the same way `let f = fun x -> fun y -> …` is closer to the actual theoretical calculus (and AST)
<sapristi>
Fardale, I would like to enable some features if a certain module (ppx_deriving yojson) is preset
<sapristi>
*present
stux|RC-only has joined #ocaml
kakadu has joined #ocaml
sonologico has joined #ocaml
Haudegen has quit [Remote host closed the connection]
<Fardale>
sapristi: I think you will need to know that at compile time
dh_work has joined #ocaml
<dh_work>
if I have a module type with two types t and u, is there any way to generate a module type from it that's restricted to the case where t = u?
<dh_work>
coherence constraints don't seem to allow it
<companion_cube>
maybe if you have another type w and say `with type t = w and type u = w`
<dh_work>
there are two implementations of the module type (let's call it M and the implementations M1 and M2)
<dh_work>
in M1, u = t; in M2, u = t thingy (for some "thingy" hopefully irrelevant to the question)
Birdface has quit [Ping timeout: 255 seconds]
<dh_work>
there's an .mli file that declares "module M1 : M" and "module M2 : M"
<dh_work>
but some stuff that uses M1 needs to know u = t
kakadu has quit [Remote host closed the connection]
<dh_work>
and unfortunately t is not the same in M1 and M2, nor can it easily be moved out
Serpent7776 has quit [Quit: leaving]
kakadu has joined #ocaml
<dh_work>
so we'd like to be able to say "module M1 : M with type u = t" but that doesn't work, nor does any simple permutatino of it
<companion_cube>
it should definitely work
<companion_cube>
even if you do `type u` and then `module M1 : M with type t=u`
<dh_work>
"with type u = t" doesn't work because t is out of scope; you can't qualify with M1 because (I guess) it doesn't exist yet at that piont, and you can't qualify with M because it's a module type and not a module
Haudegen has joined #ocaml
<dh_work>
hmm
<dh_work>
you just gave me an idea though
<companion_cube>
ah sorry, then I mean `type t\n type u\n module M1 : M with type t=t and type u=u`
<companion_cube>
or even: `module M1 : M module M2 : M with type t = M1.t and type u = M1.u`
<dh_work>
I just tried "type w module M1 : M with type t = w and type u = w" and this claims that the kinds differ (they don't)
<companion_cube>
can you paste some code online?
<companion_cube>
for me this should really work
<companion_cube>
(in a mli)
<dh_work>
my officemate just posted to stack overflow
<companion_cube>
`type w module Value1 : Value with type word=w and type t_word=w`
<companion_cube>
(also you need to define `w` in the ml)
<octachron>
another solution would be `module type M2 = sig type t include M with type t:=t and type u = t end`
<dh_work>
that's what we just tried, and it claims the kinds of w and word don't match
<octachron>
or more acrobatic "module rec M1: M with type u = M1.t"
<companion_cube>
what's the concrete type you use?
<dh_work>
but it works for a simple example
<dh_work>
grr.
<companion_cube>
are you sure you don't use `list` for w, or something like that?
<companion_cube>
something polymorphic?
<dh_work>
we specifically said just "type w"
<dh_work>
without binding it to anything
<companion_cube>
in the mli, but in the ml?
<dh_work>
in M, the type of t is a sum and u is unbound
<dh_work>
it doesn't get as far as trying to compile the .ml file
<companion_cube>
ôO
<octachron>
if t is exposed as variant in the module type `M`, you need to keep it a variant in the new module type
<dh_work>
ah I get the same behavior with a slighty different simple example
<octachron>
module type M' = sig type t = Exactly_the_same_definition_as_t include M with type t:= t type u = t end