rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tiferrei has quit [Quit: ZNC 1.8.2+deb2build1 - https://znc.in]
tiferrei has joined #ocaml
<d_bot>
<cod1r> Sup
Serpent7776 has joined #ocaml
sagax has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
gravicappa has joined #ocaml
GreaseMonkey has quit [Remote host closed the connection]
sagax has joined #ocaml
gravicappa has quit [Ping timeout: 260 seconds]
mbuf has quit [Quit: Leaving]
gravicappa has joined #ocaml
<d_bot>
<Patate> Hello, is it possible to split two modules that depend on each other int two separate .ml files?
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
olle has joined #ocaml
<d_bot>
<octachron> No, cyclic dependencies are not allowed for compilation units.
<d_bot>
<Patate> Okey, thanks, I just saw you can transform them to functors (taking the module they depend on), and then do something like this to get the modules;
<d_bot>
<Patate> ```ocaml
<d_bot>
<Patate> module rec M1 = F1(M2)
<d_bot>
<Patate> and M2 = F2(M1)
<d_bot>
<Patate> ```
<d_bot>
<Patate> So I guess it is possible to at least put these functors in different files
<d_bot>
<octachron> Functors are indeed a way to break a cyclic dependency. It is also often possible to break the cycle by isolating a (strongly connected) core subset of both modules into their own separate module, since it is rare that everything in `M1` depends on everything in`M2` and reciprocally.
waleee has quit [Ping timeout: 252 seconds]
waleee has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
gravicappa has quit [Ping timeout: 260 seconds]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
aspe has joined #ocaml
aspe has quit [Quit: aspe]
<d_bot>
<Continuation Calculus> (I would also not recommend recursive modules like this except if there is no other way)
<d_bot>
<Patate> Oh? why so?
<d_bot>
<Continuation Calculus> Because I had many different kinds of problems everytime I wanted to expand beyond straightforward stuff
<d_bot>
<octachron> Recursive modules are one of the most complex feature of the language (and no one knows a good specification for them).
<d_bot>
<Continuation Calculus> Yup.
<d_bot>
<Continuation Calculus> And I would add, not "complex" in a "the module system is so complex and powerful with abstraction and functors way!!"-way, but in a "I want to quit everything"-way
kakadu has quit [Remote host closed the connection]
<d_bot>
<Patate> urg
<d_bot>
<octachron> Climbing the complexity ladder is something that you should avoid whenever possible (outside of learning experiences). And recursive modules stands very high on this ladder.
<d_bot>
<Continuation Calculus> If you truly must, a minimal recursive module that only contains types, and not build stuff more complex than that on top of it (ie, not a building block in your architecture, but its peak complexity)q
<d_bot>
<Continuation Calculus> If you have an example that you can share, feel free :)
<d_bot>
<Continuation Calculus> There might be a better alternative
<d_bot>
<Patate> So you think I should rather group code in one file? The aim was mostly to split into files for modularity
<d_bot>
<Continuation Calculus> Nope, I more meant that there might be alternatives to have the thing be modukar
<d_bot>
<Patate> Oh I see
<d_bot>
<Continuation Calculus> It's quite rare to truly need mutual dependencies, even if it comes up intuitively
amk has quit [Ping timeout: 240 seconds]
amk has joined #ocaml
<d_bot>
<Patate> My example is that there is a `Type` module, with a sum `type t`. Each constructor for `t` is like `A of A.t`
<d_bot>
<Patate> Now, in Type, there is `to_string : t -> string`, that can call `A.to_string`. Problem is that `A.t` is made of `Type.t`'s, and so has to call `Type.to_string`
<d_bot>
<Patate> And i wanted a file per constructor so it is modular
<d_bot>
<Patate> some of them do not depend on `Type.t`, so easy, but some of them do...
<gopiandcode>
one alternative would be to make the A.t polymorphic over their recursive occurrences of Type.t
<gopiandcode>
e.g `type t = Example of string * Type.t` --> `type 'a t = Example of string * 'a`
<d_bot>
<Patate> Mmh, that is nice, but what is the equivalent for the functions to_string? as I still need to do :`Example.to_string (s, t) = s ^ (Type.to_string t)`?
<d_bot>
<Patate> Oh I know.
<d_bot>
<Patate> Type.to_string is recursive, and "gives" itsel to Example.to_string.
<d_bot>
<Patate> So `Example.to_string` gets `Type.to_string` as an argument, and uses it on it's E`xample.t` argument's `Type.t` sub-components!
<d_bot>
<Patate> Is that a "more ok" way to go?
<d_bot>
<darrenldl> i think the typical arrangement would be to just put the types in same module? (naming A.t to something else etc)
<d_bot>
<Patate> Yes, but I would like to avoid having everything in the same module, as each constructor of `Type.t` has a different to_string function, and corresponding `type t`
<gopiandcode>
@Patate: yup, exactly
<d_bot>
<darrenldl> you can still use submodules for operations of the different types?
<d_bot>
<darrenldl> (or at least seems relatively usable still, but im not good at api design so hmmm
<d_bot>
<Patate> problem is that operations might depend on the root module Type
<d_bot>
<Patate> Thank you so much @octachron @Continuation Calculus and gopiandcode for discouraging module recursion! This approach indeed looks lot nicer
<d_bot>
<Continuation Calculus> It depends what you mean by "it depends on the root module"
<d_bot>
<Patate> edited
<d_bot>
<Continuation Calculus> Your example of `A.to_string` does not need `Root`. It only needs to be polymorphic and get an auxiliary `to_string` function to use (Same as `List` or `Option`)
<d_bot>
<Continuation Calculus> With pleasure, it will also uncover parts that are more general than expected
mro has quit [Ping timeout: 248 seconds]
<d_bot>
<Patate> what do you mean by "more general than expected"?
bartholin has joined #ocaml
<d_bot>
<Patate> what do you mean by "more general than expected" @Continuation Calculus ?
<d_bot>
<Continuation Calculus> Less tied to Root than what you'd expect
<d_bot>
<Patate> Oh, yes, some cases are not tied at all! it's just some of them that pose problem 🙂
Sankalp has quit [Ping timeout: 256 seconds]
wingsorc has quit [Quit: Leaving]
dhil has joined #ocaml
Sankalp has joined #ocaml
Sankalp has quit [Ping timeout: 252 seconds]
Sankalp has joined #ocaml
gravicappa has joined #ocaml
bobo has joined #ocaml
spip has quit [Ping timeout: 260 seconds]
azimut_ has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: Bin weg.]
Sankalp has quit [Ping timeout: 252 seconds]
dhil has quit [Ping timeout: 248 seconds]
Sankalp has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
vicfred_ has joined #ocaml
bartholin has joined #ocaml
vicfred has quit [Ping timeout: 240 seconds]
szkl has joined #ocaml
vicfred_ has quit [Quit: Leaving]
Haudegen has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
szkl has quit [Quit: Connection closed for inactivity]
zebrag has joined #ocaml
xgqt has quit [Read error: Connection reset by peer]
xgqt has joined #ocaml
mro has joined #ocaml
olle has quit [Ping timeout: 248 seconds]
rgrinberg has joined #ocaml
aspe has joined #ocaml
OCamlPro[m] has quit [Quit: You have been kicked for being idle]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
gravicappa has joined #ocaml
<d_bot>
<nlucaroni> It had to have been maybe 3-5 years ago, but someone had posted somewhere about a data structure that was implemented by flipping the polymorphic key value pair at every level. I was thinking about something similar and didn't recall what this original data structure was used to model. I think it was a bimap? Anyway, does anyone have a recollection of what I am thinking about and might know where this post is? I haven't had any
slothby has quit [Quit: brb ... maybe]
olle has joined #ocaml
slothby has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
aspe has quit [Quit: aspe]
Tuplanolla has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
mro has joined #ocaml
<d_bot>
<mbacarella> ocaml-migrate-parsetree has a `val Versions.migrate : 'from ocaml_version -> 'to_ ocaml_version ('from, 'to_) migration_functions` which doesn't appear to exist in ppxlib?
mro has quit [Read error: Connection reset by peer]
mro has joined #ocaml
<d_bot>
<mbacarella> did this get renamed? or is this kind of magic not available anymore?
<sim642>
Doesn't ppxlib migrate to its own internally fixed version of the AST?
<d_bot>
<mbacarella> don't know. just trying to get a project that used to use ppx_tools_versioned to work on recent ocaml
<d_bot>
<mbacarella> this project seems to construct expressions to ast 404 and then migrate them to current to print them.
<sim642>
Looks like ppxlib has astlib in it, which is just some vendored version of OMP
<d_bot>
<mbacarella> right. but OMP includes Versions = Migrate_parsetree_versions whereas astlib does not at all
<d_bot>
<mbacarella> perhaps that's just magic that saves you the trouble of manually bumping from 404 -> 405 -> 406 -> whatever current is
<d_bot>
<mbacarella> oh! it's in ast/versions.ml
<d_bot>
<mbacarella> huh there's a lot of macro stuff here. perhaps this is why my grepping fails. migrate does not appear to be exposed
<d_bot>
<mbacarella> holy crap. objects.
<d_bot>
<mbacarella> i think i need to cancel all of my plans and fly to a hotel room next to the airport in another city and dig the fuck in
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut has joined #ocaml
gravicappa has quit [Ping timeout: 252 seconds]
Serpent7776 has quit [Quit: leaving]
olle has quit [Ping timeout: 248 seconds]
rgrinberg has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
mro has quit [Quit: Leaving...]
dhil has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]