leah2 has quit [Read error: Connection reset by peer]
jtck has quit [Remote host closed the connection]
jtck has joined #ocaml
<d_bot>
<thangngoc89> @monk it’s 100% OCaml now
<d_bot>
<thangngoc89> @Drup added a short description in README. Could you please take a took and tell me if that’s understandable https://github.com/thangngoc89/ocaml-slug
jinsun has quit [Read error: Connection reset by peer]
jinsun has joined #ocaml
<d_bot>
<g_w1> anyone have good examples of idomatic small-ish ocaml codebases?
<d_bot>
<antron> i could suggest lambda soup <https://github.com/aantron/lambdasoup> consisting of one source file and all the extras for testing it etc
<d_bot>
<g_w1> thanks
waleee has quit [Ping timeout: 252 seconds]
<d_bot>
<thangngoc89> It’s a joy to read github.com/aantron/* libraries
mbuf has joined #ocaml
zebrag has quit [Remote host closed the connection]
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
<d_bot>
<thangngoc89> What is the ocamlc flag that list all the references inside a module?
<d_bot>
<octachron> What do you mean by references? References to other modules?
Tuplanolla has joined #ocaml
<d_bot>
<thangngoc89> @octachron yes.
<d_bot>
<thangngoc89> I want to know which module/identifier the current module is referring
<d_bot>
<octachron> It is more ocamldep than ocamlc that you want. (You can use `ocamlc -depend` which does the same thing but outside of the compiler development, it is better to use ocamldep).
<d_bot>
<thangngoc89> @octachron thank you very much.
leah2 has joined #ocaml
<d_bot>
<thangngoc89> Should I use list or array for static list of 1000 elements that I would only iterate on it a single time?
bartholin has joined #ocaml
<d_bot>
<octachron> How is the data created? If you control the representation, an array will be slightly more compact. But if you iterate on it only once, it would probably not matter either way.
<d_bot>
<thangngoc89> @octachron it’s auto generated into a source code file. And will be turned into a hash table immediately at runtime.
<d_bot>
<octachron> Then an array is better (you might need/want to split the array in chunks depending on its size).
<d_bot>
<thangngoc89> @octachron around 600 items. Why does split the array in chunks would be better? Could you elaborate on that?
<d_bot>
<octachron> The compiler makes no guarantee on having reasonable time/memory behaviors on generated code. `600` items is (probably) fine.
<d_bot>
<octachron> However, huge literals are known to have issues.
<d_bot>
<thangngoc89> I see. I guess I should just do it and see if any problems arose
<d_bot>
<Kakadu> I'm trying to substitute a type parameter in module signature. I want to write
<d_bot>
<Kakadu> ```
<d_bot>
<Kakadu> # module type XXX = (Map.S with type 'a t := int XXX.t) ;;
<d_bot>
<Kakadu> Error: Unbound module XXX
<d_bot>
<Kakadu> ```
<d_bot>
<Kakadu> The thing that works is `module type XXX = (Map.S with type 'a t := int Map.Make(Int).t)` but there I expose internals of type `_ XXX.t` and I don't want to do it.
<d_bot>
<Kakadu> Any advice how to do it? Or why it should not be done this way because type system becomes inconsistent or something?..
<d_bot>
<octachron> What is supposed to be `XXX` in `Map.S with type 'a t := int XXX.t`?
<d_bot>
<Kakadu> The module type which I'm defining. I'm trying to specialise type parameter
glassofethanol has joined #ocaml
<d_bot>
<octachron> A module type doesn't define any type. You need a concrete type to do the substitution.
<d_bot>
<Kakadu> `Map.S` has `'a t` inside. Isn't it concrete enough?
<d_bot>
<octachron> No, like I said a module type doesn't define a concrete type. It is a specification for a module.
<d_bot>
<octachron> Also the replacement cannot work in this specific instance since `Map.S` requires `'a t` to be injective.
<d_bot>
<octachron> Otherwise, you could do something like: `module type XXX = sig type 'a t include (Map.S with type 'a t := int t) end`
<d_bot>
<Kakadu> It looks like 4.10 doesn't require injectivity and `module type XXX = sig type 'a t include (Map.S with type 'a t := int t) end;;` works almost as I need
<d_bot>
<Kakadu> @octachron Thanks!
<d_bot>
<Kakadu> Is there any short hack to write a short structure that suites module type above?
<d_bot>
<Kakadu> ```
<d_bot>
<Kakadu>
<d_bot>
<Kakadu> module Env : sig
<d_bot>
<Kakadu> type 'a t
<d_bot>
<Kakadu>
<d_bot>
<Kakadu> include Map.S with type 'a t := int t
<d_bot>
<Kakadu> end = struct
<d_bot>
<Kakadu> type 'a t
<d_bot>
<Kakadu>
<d_bot>
<Kakadu> include (Map.Make (String) : Map.S with type 'a t := int t)
<d_bot>
<Kakadu> (* Values do not match:
<d_bot>
<Kakadu> val empty : 'a t/1
<d_bot>
<Kakadu> is not included in
<d_bot>
<Kakadu> val empty : int t/2*)
<d_bot>
<Kakadu> end
<d_bot>
<Kakadu> ```
<zozozo>
@Kakadu : please use an online paste service for such code blocks, ^^
<d_bot>
<Kakadu> okay
<zozozo>
(the reason is that such code blocks are not really great to read on the irc side of the channel)
<d_bot>
<Kakadu> @guigui Although, on Discord it adds link preview that is not smaller then original peice of code
<zozozo>
I see (also, note that irc users do not see message edits)
<d_bot>
<mimoo> I'm getting an error: "Error: Syntax error" and that's it
<d_bot>
<mimoo> any idea on how to debug that?
<d_bot>
<thangngoc89> You should at least get a file location right?
<d_bot>
<mimoo> first line of the main file
<d_bot>
<mimoo> which seems like an incorrect error
<d_bot>
<mimoo> "File "lib/randoml.ml", line 1: Error: Syntax error"
<d_bot>
<thangngoc89> That’s when something doesn’t implement error handler correctly
<d_bot>
<thangngoc89> Could be preprocessor or ppx
<d_bot>
<Ulugbek> can you show us the code?
unyu has joined #ocaml
unyu has left #ocaml [#ocaml]
mbuf has quit [Quit: Leaving]
<d_bot>
<mimoo> looks like it was in a test somewhere else in the file
waleee has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
vb has quit [Quit: Lost terminal]
vb has joined #ocaml
<d_bot>
<darrenldl> @thangngoc89 re timere/timedesc's case: drup (and i) ended up switching to storing the generated sexp of the db, which is read by a code gen that generates a .ml file with the marshalled string of the db during installation of the package
<Armael>
oh dear
<Armael>
that's a bit convoluted but I can imagine how you got to that solution
<d_bot>
<darrenldl> ah everything drup mentioned is in the issue (i was not certain if it was only brought up in convo and not documented)
<d_bot>
<darrenldl> but yes, it makes the code gen a bit of a catch 22
<d_bot>
<darrenldl> which ends up with having an empty database as "base case" via dune's virtual lib in code gen, which generates the full db
<d_bot>
<darrenldl> (full db sexp)
gwizon has joined #ocaml
<d_bot>
<thangngoc89> Oh dear.
isekaijin has joined #ocaml
<d_bot>
<darrenldl> i think above is not necessary if you don't offer database de/serialisation code in your library - timedesc contains them, so we want to reuse as much of timedesc as possible
<d_bot>
<darrenldl> (the virtual lib part anyway)
<d_bot>
<darrenldl> as for two pass code gen - first pass of sexp code gen phase is necessary since that is really slow and depends on OS data, i run this code gen on my own computer to embed data into the git repo, second pass is only for giving a more compact representation during library use by swapping to marshalled string when library is installed
<d_bot>
<darrenldl>
<d_bot>
<darrenldl> one pass into marshalled might suffice for you already
<companion_cube>
or canonical sexprs or whatever :p
<d_bot>
<darrenldl> yep, depends on how much speed you need
<d_bot>
<darrenldl> tldr: everything seems fine if you have one really long string, not so much when you have one or multiple really long expressions though
Haudegen has joined #ocaml
gwizon has quit [Ping timeout: 252 seconds]
gwizon has joined #ocaml
waleee has quit [Ping timeout: 246 seconds]
_whitelogger has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
isekaijin has quit [Quit: WeeChat 3.2]
glassofethanol has quit [Quit: leaving]
waleee has joined #ocaml
<d_bot>
<thangngoc89> How can I tell `ocamlopt` to produce cmi and cmx file in another directory?
<d_bot>
<thangngoc89> no matter where the current working dir is, `ocamlopt` produces the cmi and cmx in the same folder as `ml` file
<d_bot>
<EduardoRFS> @thangngoc89 -o ?
bartholin has quit [Quit: Leaving]
<d_bot>
<thangngoc89> @EduardoRFS it's for executable only
<d_bot>
<antron> even the docs byline needs changing i guess, it makes no sense to me now
<d_bot>
<antron> from the C docs "The realpath() function shall derive, from the pathname pointed to by file_name, an absolute pathname that resolves to the same directory entry, whose resolution does not involve '.', '..', or symbolic links."
<companion_cube>
very nice
<d_bot>
<antron> im not sure if it behaves exactly the same as path.resolve, though
<d_bot>
<thangngoc89> @companion_cube node's path.resolve is very foolproof . Trying to go as little libraries as possible and especially not C libraries
<companion_cube>
if it's foolproof because of libuv it seems a bit contradictory :p
<d_bot>
<thangngoc89> what are the accepted filename for ocaml source code file? [A-z0-9\_]+ ?
<d_bot>
<antron> yep luv is a pretty invasive change. however it is not a C library. and it binds to the C library inside nodejs 🙂
<d_bot>
<antron> (im not seriously suggesting it, i actually opened the File docs to prove that such a function is not there, but its there :P)
<d_bot>
<thangngoc89> Note to self: check node's source code to see how `path.resolve` is implemented