<oni-on-ion>
ahh! reminds me of when i had to make *.hs.boot for haskell . ocaml modules seem to solve this
<Netsu>
modules are ok. Dune not (yet).
<companion_cube>
afaik packs didn't allow you to do this either
<oni-on-ion>
maybe dune can be set up better? i had trouble with it at first
<Netsu>
companion_cube: opam packages? Why not, it's just code generation phase by dune. At the end it would be plain list of prefixed modules, I guess. Like module_without_implementation ones
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
<companion_cube>
no, I meant ocaml -pacl
<companion_cube>
pack
<companion_cube>
the old way of doing these multi files modules
<Netsu>
I'm too noob for that
jao has quit [Remote host closed the connection]
<Netsu>
but maybe it could be hacked by dune's 'rule'
<companion_cube>
just write the file by hand…
Haudegen has joined #ocaml
Serpent7776 has joined #ocaml
sodastab has joined #ocaml
sodastab has quit [Excess Flood]
sodastab has joined #ocaml
sodastab has quit [Excess Flood]
sodastab has joined #ocaml
Jesin has quit [Quit: Leaving]
<oni-on-ion>
how can i export a module ?
<oni-on-ion>
ie. if an (executable) uses a (library) which has (modules)
barockobamo has quit [Remote host closed the connection]
barockobamo has joined #ocaml
<companion_cube>
the library exports the modules
<oni-on-ion>
hmm not working at all for any modules
<oni-on-ion>
would it matter if its (exe) -> (library) -> (library) ? the last one with modules
<oni-on-ion>
so confuse
Jesin has joined #ocaml
barockobamo has quit [Remote host closed the connection]
barockobamo has joined #ocaml
<oni-on-ion>
hmm nope. i dont understand how to access modules from a libary
<oni-on-ion>
i don't get it. i am stuck, nothing is working; i see no point in libraries now
<octachron>
What are you trying? Did you remember that library are wrapped by default?
barockobamo has quit [Ping timeout: 258 seconds]
<octachron>
i.e., if you have a module A in a library lib, dune exports it as Lib.A by default
Jesin has quit [Quit: Leaving]
<oni-on-ion>
my project dir "tools" is the library, which i intend to be used by the sub dirs "app1" , "app2"
<oni-on-ion>
i think dune wants me to have it the other way around, ie app1 -> [tools] , app2 -> [tools] which is the opposite of what i want, because [tools] is shared between the apps.
okuu has quit [Quit: ERC (IRC client for Emacs 26.2)]
Jesin has joined #ocaml
<octachron>
If you want to use tools in app1, you just need to add tools in the list of library dependencies of app1: e.g. (libraries (tools ...))
<oni-on-ion>
there must be something i am overlooking in this trivial
<oni-on-ion>
tried, will try again
<oni-on-ion>
yep nope
<oni-on-ion>
hmmmm.
<oni-on-ion>
do i need .mli files ?
<companion_cube>
no, they're just good practice
kakadu has quit [Quit: Konversation terminated!]
<octachron>
another potential issue, do you happen to have a module named tools.ml in tools?
<oni-on-ion>
companion_cube, ok. will get there =)
<oni-on-ion>
octachron, yep !
<companion_cube>
then you need to export A from it
<companion_cube>
module A = A
jao has joined #ocaml
<oni-on-ion>
i've moved tools.ml instead
<oni-on-ion>
hmmm that helped! so i had to export it because i was using the module name named after the lib =)? makes sense
<oni-on-ion>
i definately learned some things =) thank you for both your patiences i very much appreciate the tolerance of my spamming/urgency. (got myself full of coffee and was half way through coding something =) bless!
<Netsu>
companion_cube: what's wrong with it, what I miss?
<companion_cube>
it seems pretty complicated for no clear benefit, is all
ShalokShalom has joined #ocaml
gravicappa has joined #ocaml
<Netsu>
benefit is uniwersal dsl approach for both top modules and sub-modules in duna without fragility and with no maitance required
<oni-on-ion>
dsl...ppx ?
<oni-on-ion>
preprocess ?
<Netsu>
dsl in plain sorce. To write Lib.Type instead of Lib.HakyHack.Type
kakadu has joined #ocaml
<companion_cube>
dune isn't fragile as of now, if you use it to have each library being a list of modules
<Netsu>
companion_cube: but what should I do if all I need is to split project into several submodules in separate hierarchical files? Such library structure broke natural dsl
<Netsu>
fragility in maintenance sense to keep all the modules explicitly listed or to run `dune test || dune promote` each time
<companion_cube>
I have absolutely no idea what you're talking about
<Armael>
you could split your library into several sub-libraries?
<companion_cube>
if you want Foo.Bar.A, have file bar.ml in lib foo, and a `module A = …` inside?
<Netsu>
ok, I can have Bar.A where A is module type, but why can not the same for Foo module?
<Netsu>
This feels like unnecessary complexity to remember which module is library, and which are not, isn't it?
unyu has quit [Ping timeout: 258 seconds]
<companion_cube>
you mean for Bar, right?
<companion_cube>
yeah, it only works for modules, not module types
<Netsu>
and not for types. And it's limitation of dune, not module system
unyu has joined #ocaml
<companion_cube>
well you can always do it by hand
<oni-on-ion>
Netsu, cant you just alias modules ?
<companion_cube>
with `(wrapped false)` or by writing `foo.ml`
<oni-on-ion>
Today I Learned: dont have modules named the same as libraries. cognitive peace and tranquility =)
<companion_cube>
except when that's what you want :D
<oni-on-ion>
yeh. the land of undefined behavior
<oni-on-ion>
(lots of exaggeration here)
<Netsu>
companion_cube: welp, that workarond is a try to avoid fragility caused by writing it by hand... However I still can miss something
<oni-on-ion>
adding rules to dune seems very much like hand-writing
<oni-on-ion>
%__.ml and whatnot going on up there
<oni-on-ion>
i feel that dune is happier if we learn what it expects, then we dont have to fight it
<companion_cube>
indeed
<Netsu>
oni-on-ion: yeah, it drawback (module_name__.ml-gen kinda private dune's api afaik)
<Netsu>
I would be happier when dune will do what I expect lol
<oni-on-ion>
i've seen .ml-gen files but it may appear as if you are getting into dune internals more than is necessary
<oni-on-ion>
yep, today is my second "trial" with dune, trying to get it to do what i want. i learned again that its not only clearer, cleaner, but more "ocaml style" the way in which dune expects
<oni-on-ion>
to do the way in which dune expects. the docs website is awfully unorganized