companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
mxns has joined #ocaml
jbrown has quit [Remote host closed the connection]
mxns has quit [Ping timeout: 264 seconds]
Tuplanolla has quit [Ping timeout: 256 seconds]
<d_bot> <ShalokShalom> Someone just said OCamls type system can not be HM, since its higher kinded polymorphism and GADT, can this be true?
Hrundi_V_Bakshi has quit [Ping timeout: 265 seconds]
Haudegen has quit [Ping timeout: 256 seconds]
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
_whitelogger has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
mfp has quit [Ping timeout: 264 seconds]
SoF has quit [Ping timeout: 268 seconds]
mmohammadi981266 has joined #ocaml
vicfred has quit [Quit: Leaving]
amiloradovsky has quit [Ping timeout: 244 seconds]
lopex has quit [Quit: Connection closed for inactivity]
<d_bot> <ggole> OCaml's type system does have quite a few extensions to HM, although not higher kinds
mxns has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
vicfred has joined #ocaml
mmohammadi981266 has quit [Quit: I quit (╯°□°)╯︵ ┻━┻]
osa1 has joined #ocaml
haesbaert has quit [Ping timeout: 272 seconds]
haesbaert has joined #ocaml
berberman_ has joined #ocaml
berberman has quit [Ping timeout: 246 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
narimiran has joined #ocaml
mxns has joined #ocaml
decentpenguin has quit [Quit: ZNC crashed or something]
mxns has quit [Ping timeout: 264 seconds]
decentpenguin has joined #ocaml
vicfred_ has joined #ocaml
mmohammadi9812 has quit [Ping timeout: 240 seconds]
vicfred has quit [Ping timeout: 256 seconds]
mmohammadi9812 has joined #ocaml
_whitelogger has joined #ocaml
osa1 has quit [Remote host closed the connection]
berberman_ has quit [Quit: ZNC 1.7.5 - https://znc.in]
berberman has joined #ocaml
wingsorc has quit [Quit: Leaving]
_whitelogger has joined #ocaml
Tuplanolla has joined #ocaml
Haudegen has joined #ocaml
mxns has joined #ocaml
xzax_[m]1 has quit [Quit: Idle for 30+ days]
mxns has quit [Ping timeout: 244 seconds]
tane has joined #ocaml
vicfred_ has quit [Quit: Leaving]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
bartholin has joined #ocaml
mmohammadi9812 has quit [Ping timeout: 272 seconds]
mmohammadi9812 has joined #ocaml
tryte has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
tryte has joined #ocaml
narimiran has quit [Ping timeout: 256 seconds]
mmohammadi9812 has quit [Ping timeout: 260 seconds]
mmohammadi9812 has joined #ocaml
tryte_ has joined #ocaml
tryte has quit [Ping timeout: 240 seconds]
lopex has joined #ocaml
bartholin has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
SoF has joined #ocaml
borne has joined #ocaml
mbuf has joined #ocaml
osa1 has joined #ocaml
tane has quit [Quit: Leaving]
amiloradovsky has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
mbuf has quit [Ping timeout: 260 seconds]
bartholin has quit [Ping timeout: 264 seconds]
steenuil has quit [Ping timeout: 258 seconds]
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
borne has quit [Ping timeout: 264 seconds]
neiluj has joined #ocaml
Anarchos has joined #ocaml
jbrown has joined #ocaml
neiluj has quit [Changing host]
neiluj has joined #ocaml
mmohammadi9812 has quit [Quit: Quit]
osa1 has quit [Remote host closed the connection]
neiluj has quit [Ping timeout: 265 seconds]
jnavila has joined #ocaml
neiluj has joined #ocaml
steenuil has joined #ocaml
neiluj has quit [Ping timeout: 256 seconds]
DanC has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
narimiran has joined #ocaml
DanC has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
kmwyard has quit [Quit: Connection closed for inactivity]
decentpenguin has quit [Ping timeout: 272 seconds]
neiluj has joined #ocaml
decentpenguin has joined #ocaml
jnavila has quit [Quit: Konversation terminated!]
jnavila has joined #ocaml
mxns has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
waleee-cl has joined #ocaml
amiloradovsky1 has joined #ocaml
amiloradovsky has quit [Ping timeout: 244 seconds]
amiloradovsky1 is now known as amiloradovsky
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 258 seconds]
tane has joined #ocaml
reynir has quit [Ping timeout: 240 seconds]
mxns has quit [Ping timeout: 246 seconds]
reynir has joined #ocaml
Haudegen has joined #ocaml
neiluj has quit [Remote host closed the connection]
<d_bot> <jktuglu> anyone have any suggestions for opening module that opam says is downloaded?
<d_bot> <jktuglu> I am receiving this error:
<d_bot> <jktuglu> ```Unbound module Conduit_lwt```
<d_bot> <jktuglu> But it says I have
<d_bot> <jktuglu> I have tried reinstalling ocaml-cohttp, running ```opam init``` but no luck
<mrvn> sounds like you are forgetting to link it
<Fardale> How do you compile your code?
steenuil has quit [Ping timeout: 260 seconds]
<d_bot> <jktuglu> im new to opam and ocaml library installing (only use basic ones)
<d_bot> <jktuglu> I have the open Conduit_lwt in the top of the file
<d_bot> <jktuglu> ```
<d_bot> <jktuglu> open Lwt
<d_bot> <jktuglu> open Cohttp
<d_bot> <jktuglu> open Cohttp_lwt_unix
<d_bot> <jktuglu> open Conduit_lwt
<d_bot> <jktuglu>
<d_bot> <jktuglu> let server =
<d_bot> <jktuglu> let callback _conn req body =
<d_bot> <jktuglu> let uri = req |> Request.uri |> Uri.to_string in
<d_bot> <jktuglu> let meth = req |> Request.meth |> Code.string_of_method in
<d_bot> <jktuglu> let headers = req |> Request.headers |> Header.to_string in
<d_bot> <jktuglu> ( body |> Cohttp_lwt.Body.to_string >|= fun body ->
<d_bot> <jktuglu> Printf.sprintf "Uri: %s\nMethod: %s\nHeaders\nHeaders: %s\nBody: %s" uri
<d_bot> <jktuglu> meth headers body )
<d_bot> <jktuglu> >>= fun body -> Server.respond_string ~status:`OK ~body ()
<d_bot> <jktuglu> in
<d_bot> <jktuglu> let tcp_config =
<d_bot> <jktuglu> {
<d_bot> <jktuglu> Conduit_lwt.TCP.sockaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, 8000);
<d_bot> <jktuglu> capacity = 40;
<d_bot> <jktuglu> }
<d_bot> <jktuglu> in
<d_bot> <jktuglu> Server.create tcp_config Conduit_lwt.TCP.protocol Conduit_lwt.TCP.service
d_bot was kicked from #ocaml by mrvn [d_bot]
d_bot has joined #ocaml
<d_bot> <jktuglu> (Server.make ~callback ())
<d_bot> <jktuglu>
<d_bot> <jktuglu> let _ = Lwt_main.run (server ())```
<mrvn> :( d_bot doesn't stop pasting when it gets kicked.
<mrvn> Who is maintainin d_bot? It really shouldn't send multi-line pastes to irc line by line.
mxns has joined #ocaml
<Fardale> @jktuglu please use paste services for code like https://paste.x25519.net/
<Fardale> And this is your file not how you compile it
steenuil has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
<mrvn> When I write "let a = 10 in let b = 20 in let foo x = a * x + b in foo how does ocaml store a and b? Can't be on the stack of the current function since foo captures them and foo is returned. Are they copied into the function object for foo?
steenuil has quit [Ping timeout: 260 seconds]
<mrvn> What if it's "let a = ref 10 in..."? Can't just make a copy of the ref there.
<d_bot> <ggole> In general free variables of `foo` are copied into the closure of `foo`
<d_bot> <ggole> But there are optimisations to avoid that for things like constants
steenuil has joined #ocaml
<mrvn> And refs are records with a mutable field so they are heap allocated. And then the pointer to the record would be copied into the closure same as any heap pointer.
<mrvn> Why did I think a ref would be a local variable?
<d_bot> <ggole> Yep, pretty much
<d_bot> <ggole> Well, there is an optimisation for refs that don't escape which turns them into local variables
<d_bot> <ggole> Perhaps you half-remembered that?
<mrvn> sure. but that's all covered under the "behaves as if" optimization rule.
<d_bot> <ggole> Indeed
<mrvn> In the above obviously any optimizer would inline the literal constants.
<d_bot> <ggole> There's also a trick where top-level variables aren't put into closures, but instead loaded from a global slot
<d_bot> <ggole> But it didn't seem like that was what your question was really about.
<mrvn> No. for global variables the lifetime is infinite so they can be just used in-place.
borne has joined #ocaml
<mrvn> I was pondering the problem that you could have "let a = ... let foo x () = ... a ... in modify a". But a is either a concrete value that's immutable, a pointer into the heap or a naked pointer from some C bindings (that really shouldn't exist).
<mrvn> a can always be copied without problems.
<mrvn> the "modify" will always change something a points to, never a itself.
<d_bot> <ggole> Yep
mxns has joined #ocaml
<d_bot> <ggole> In some languages with first-class functions and mutable variables (eg, Scheme) you do have that problem, which is usually addressed with assignment conversion
<mrvn> or c++
<d_bot> <ggole> In which variables which are assigned get turned into refs, and then it's pretty much the same from there
<d_bot> <jktuglu> @ggole do you have any insights to my question?
<mrvn> jktuglu: YOu still haven't shown how you compile your code
neiluj has joined #ocaml
neiluj has joined #ocaml
<mrvn> ggole: I think in C++ you simply get undefined behavior when refereing to variables in lambdas after leaving their scope.
<d_bot> <ggole> That's kinda nasty, but of course they can't really transparently heap-allocate
<mrvn> jktuglu: That's still just your code. not how you compile it
<d_bot> <jktuglu> dune exec ./backend/server/server_example.exe
Guest268 has joined #ocaml
<d_bot> <jktuglu> is this what you mean?
<mrvn> jktuglu: kind of. but now we need to see the dune file you use. Surely that has to list what other modules to link to.
<d_bot> <jktuglu> dune file:
<mrvn> or does dune link to anything it sees as being used in the source?
<d_bot> <jktuglu> file heirarchy
mxns has quit [Ping timeout: 240 seconds]
<mrvn> I've never used dune but I would say you have to add Cohttp and Conduit_lwt to the libraries line.
<d_bot> <jktuglu> i thought of that, but the Lwt module isnt part of Cohttp module?
<d_bot> <jktuglu> seen in the imports portion
<mrvn> cohttp-lwt-unix probably already links to Cohttp so you get that implicitly.
<d_bot> <jktuglu> so wouldnt I have to add Lwt for it to work as well?
<d_bot> <jktuglu> ah okay
<mrvn> same for lwt.
<Guest268> I am new here..guys
<Guest268> what is the first things do i need to do??????\
<mrvn> make coffee
<Guest268> any body who can help
<d_bot> <ggole> It's hard to know which modules are included in what without having used those libraries before
<Guest268> ??????
<mrvn> My philosophy is to not rely on any implicit stuff. If you use LWT then link against LWT explicitly. If you use Unix, link against it. If it's already included implicitly nothing bad happens. But if it's missing then it won't link.
<d_bot> <jktuglu> Library "cohttp-lwt-unix," not found.
<d_bot> <jktuglu> from
<mrvn> And in the future the implicitl stuff might change and your code would suddenly fail.
Guest268 has quit [Max SendQ exceeded]
<d_bot> <jktuglu> okay thanks
<mrvn> jktuglu: Now you need someone that knows dune or read the documentation on how to specify multiple libraries.
<mrvn> maybe just space seperated since it things the "," is part of the library name.
<mrvn> thinks even
<d_bot> <jktuglu> i tried this, and still get the unbound module Conduit_lwt
nullcone has joined #ocaml
<d_bot> <jktuglu> ```onduit_lwt.TCP.sockaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, 8000);
<d_bot> <jktuglu> ^^^^^^^^^^^^^^^^^^^^^^^^
<d_bot> <jktuglu> Error: Unbound module Conduit_lwt```
<mrvn> odd. Sorry, out of ideas.
<d_bot> <jktuglu> all good, thanks for your help.
<d_bot> <ggole> Where's `Conduit_lwt` from? Is that another library?
<mrvn> maybe search for examples using conduit-lwt. Maybe it's named differently.
<mrvn> e.g. Conduit.Lwt or so
<d_bot> <ggole> A look through `ocamlfind list` to ensure that you have everything installed couldn't hurt, too
<mrvn> ggole: conduit-lwt is an opam package.
<mrvn> "A portable network connection establishment library using Lwt"
<mrvn> Odd, cohttp-lwt-unix requires conduit-lwt. So it should be included implicitly already.
<d_bot> <jktuglu> yea i tried uninstalling and saw that it was a dep
<d_bot> <jktuglu> then I reinstalled, and received same error
<mrvn> try compiling that.
<d_bot> <ggole> That looks like the source of the dune file
<Fardale> @jktuglu just a space to have a list of libraries for example (libraries result bytes conduit mirage-time mirage-clock cstruct uri)
<Fardale> so in your case you will need something like "(libraries cohttp-lwt-unix conduit-lwt)"
<mrvn> jktuglu: by the way: Conduit_lwt.TCP.sockaddr in that record makes no sense. 1) you already opened Conduit_lwt so it would be just TCP.sockaddr. But next line you have just "capacity". That would have to be Conduit_lwt.TCP.capacity as well.
<mrvn> s/But/2) But/
<mrvn> Maybe the error is just that Conduit_lwt.TCP has no record with a label sockaddr.
<d_bot> <jktuglu> okay this is boiler from the cohttp website
<d_bot> <jktuglu> so I assumed there was nothing wrong with logic
<d_bot> <jktuglu> Fardale, I already did this:
<d_bot> <jktuglu> ```(executable
<d_bot> <jktuglu> ; (public_name server_example)
<d_bot> <jktuglu> (name server_example)
<d_bot> <jktuglu> (libraries cohttp-lwt-unix conduit-lwt))
<d_bot> <jktuglu>
<d_bot> <jktuglu> ```
<Fardale> And you still get "Unbound module Conduit_lwt" ?
<d_bot> <jktuglu> yes
<d_bot> <jktuglu> ```File "backend/server/server_example.ml", line 18, characters 6-30:
<d_bot> <jktuglu> 18 | Conduit_lwt.TCP.sockaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, 8000);
<d_bot> <jktuglu> ^^^^^^^^^^^^^^^^^^^^^^^^
<d_bot> <jktuglu> Error: Unbound module Conduit_lwt```
<Fardale> where is the dune file whith regards to the source file?
mxns has joined #ocaml
<d_bot> <jktuglu> source is the server_example
<d_bot> <jktuglu> and the dune is the one
<d_bot> <Drup> Guys guys, I need a new stupid side project
<d_bot> <Drup> preferably with some type wizardery
<d_bot> <Drup> or some regex
<d_bot> <Drup> Please submit your demands for type wizardery
mxns has quit [Ping timeout: 272 seconds]
<Fardale> @jktuglu I did try on my side and I got a different error
<d_bot> <theangryepicbanana> > or some regex
<d_bot> <theangryepicbanana> @Drup make a textmate/editor grammar lol
<d_bot> <theangryepicbanana> plenty of regex to go around there
<d_bot> <Drup> heh, just use this new thingy that has grammars for all the languages in the universe
<d_bot> <theangryepicbanana> x to doubt
<d_bot> <jktuglu> what is your file setup?
<d_bot> <jktuglu> fardale^
<Fardale> just the line of the error in server_example.ml and your dune file
<d_bot> <joris> It is probably not your kind of hype and not type wizardery enough for you. But I get more and more and more the feeling that lwt monad is not the right abastraction for concurrency to write middleware / rest servers. When you think about it monad are only useful to implement the logic of ios but everything in between is just some computation graph non blocking that needs to be efficiency scheduled as some kind of bfs and properly
<d_bot> <joris> @theangryepicbanana why text mate. Treesitter... It supports ocaml but not text object yet
<d_bot> <theangryepicbanana> by textmate I mean like anything that supports textmate-style grammars
<d_bot> <Drup> @joris that's kinda solved by multicore ocaml though
<d_bot> <theangryepicbanana> treesitter seems unorganized and I can't find docs for it
<d_bot> <joris> @Drup right
<d_bot> <ostera> @Drup i'd like untagged union types
<d_bot> <Drup> not happening, inference is a mess for that
<Fardale> @jktuglu with your source file and your dune file it does compile
<d_bot> <joris> @theangryepicbanana I'm using tree sitter grammar in neovim for a month it works fine
<d_bot> <theangryepicbanana> docs though?
<d_bot> <joris> But it is missing queries for text objects
<d_bot> <ostera> 😦
<d_bot> <ostera> 😢
<d_bot> <Drup> Also, I meant *library-level* type wizardery. Type-system improvements are not done on my spare times, I do enough of them on my work time
<d_bot> <ostera> ah okay!
<d_bot> <theangryepicbanana> I actually make textmate grammars for fun, so it's definitely interesting to me
<d_bot> <ostera> @Drup how about a toolkit for building data pipelines
<d_bot> <Drup> eh, I claim incomptence on data pipelines
<Fardale> So I don't know where the problem is, but not on those two
<d_bot> <jktuglu> fardale I will try now
<d_bot> <ostera> how about an embeddable ocaml interpreter, a-la lua
<mrvn> Drup: how about bitfiels for cstruct?
<d_bot> <jktuglu> fardale same error
<d_bot> <joris> @Drup typed css dsl when?
<d_bot> <jktuglu> ```Info: Creating file dune-project with this contents:
<d_bot> <jktuglu> | (lang dune 2.7)
<d_bot> <jktuglu> File "server_example.ml", line 18, characters 6-30:
<d_bot> <jktuglu> 18 | Conduit_lwt.TCP.sockaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, 8000);
<d_bot> <jktuglu> ^^^^^^^^^^^^^^^^^^^^^^^^
<d_bot> <jktuglu> Error: Unbound module Conduit_lwt
<d_bot> <jktuglu>
<d_bot> <jktuglu> ```
<d_bot> <Drup> @ostera actually, I would really like to improve the toplevel
<d_bot> <Drup> but it's *REALLY NOT FUN*
<d_bot> <Drup> the code is fucking awful
<Fardale> @jktuglu don't paste multiline
<d_bot> <Drup> @joris I must admit, I'm still not quite sure what is needed there
<d_bot> <jktuglu> Fardale: here is a link to error
<d_bot> <joris> Thought to be honest css ecosystem is already quite good in ocaml and reason
<d_bot> <Drup> If you have concrete ideas, I'm curious
<d_bot> <jktuglu> https://paste.x25519.net/ura#5UhTio+2hrrixx5QqY0Lw/3tGFQH/oOgTyf8v4QE8Uo=
<Fardale> I don't know, it does work on my computer
<d_bot> <Drup> mrvn: what do you have in mind ?
berberman has quit [Ping timeout: 272 seconds]
<d_bot> <jktuglu> what are your opam versions?
berberman_ has joined #ocaml
<d_bot> <jktuglu> you said you dont use dune?
<d_bot> <joris> I don't have concrete idea. The main missing thing is to implement proper rules merging (currently the only lib that works well is finding to js lib) but I assume it is pretty boring
<mrvn> Drup: some form of ppx extension that lets you specify bitfiles like in C and get an identical result.
<mrvn> Drup: has to work with sexp too
<d_bot> <Drup> mrvn: hmm, I should look it up, I don't much about it. There are various bit-level parsing libraries in ocaml already though
neiluj has quit [Ping timeout: 258 seconds]
<d_bot> <Drup> well, byte-level
<d_bot> <ostera> @Drup does the top-level support code-reloading?
<d_bot> <Drup> no
<d_bot> <ostera> how about that
jbrown has quit [Ping timeout: 246 seconds]
<d_bot> <ostera> fun enough for you? 😛
<d_bot> <Drup> If I knew how to do it, it would already be done
<mrvn> Drup: 1) needs to be bit levcel, 2) you need to figure out the bit offsets for each field so it matches the corresponding C struct.
<d_bot> <Drup> (code reload in a typed language is *really* hard)
<d_bot> <jktuglu> Fardale: Is your opam version 2.0.7?
<mrvn> 3) you want efficient code to access and modify the fields
<d_bot> <ostera> > (code reload in a typed language is *really* hard)
<d_bot> <ostera> @Drup i'm looking forward to bashing my head against this in the following months
<d_bot> <Drup> mrvn: it doesn't seem so difficult to extend ppx_cstruct to do that, no ?
<mrvn> ostera: What should code reload do? Just reevaluate all the code you input since start again? That would just have the same result.
<mrvn> Drup: if you know what you are doing then probably not.
<d_bot> <joris> Meh all of my ideas are stupid. Not very practical and typed but involves regex : a lib to use automata as compressed data structures. Also not regex but compile time perfect hashing is nice
<d_bot> <ostera> mrvn: it'd reload code but keep the environment
<d_bot> <Drup> @joris it's better if it's not practical, really
<d_bot> <ostera> you'd need to retype whatever's currently in scope, possibly keep separate versions of the types, indexed by the module versions, or drop parts of the environment
<d_bot> <joris> (I really love rust libs for perfect hashing hashtable generation and the lib (fst) to generate automaton from string data set to store a map is pretty cool. I actually used it in prod some time ago
<mrvn> ostera: That would break code like "let f x = f x
<d_bot> <ostera> mrvn: yes, and that's something to deal with
<d_bot> <joris> Almost as good as zstd compression and immensely faster lookup
<d_bot> <Drup> > a lib to use automata as compressed data structures
<d_bot> <Drup> Actually, I was considering that one ...
<d_bot> <Drup> you compile regex into transducer that emits bitcode of the parsetree
<mrvn> ostera: or more preciscely it would unbreak it. Stuff that fails to compiled before because somethign wasn't defined would suddenly compile. Any correct input would not use anything from the env you kept.
<d_bot> <joris> Also it is not so useless. Afaik it is used by lucene
<d_bot> <Drup> link to the rust libraries ?
zebrag has joined #ocaml
<mrvn> ostera: Only use case I can see would be if you modify a module you open in the toplevel and you want to rerun your test case over and over after every edit.
inkbottle has quit [Ping timeout: 260 seconds]
<d_bot> <ostera> repls are nice to explore stuff too
<d_bot> <joris> https://github.com/sfackler/rust-phf this is the perfect hashing one but I guess it interests you less
<mrvn> Does the top level have something like pythons dir(<module>) that lists all the values the module has?
<d_bot> <ostera> you can use #show
<d_bot> <Drup> oh, from the wording I though there was a rust lib for automata compression
<d_bot> <joris> Ah no. I mean maybe but I don't know
<mrvn> no a drup project then
<d_bot> <joris> I don't know much about the internal of rust regex lib besides 'it is fast as hell'
<d_bot> <joris> Faster than re2 from experience
mxns has joined #ocaml
<d_bot> <Drup> it would be good to bench ocaml-re and compare that too
<d_bot> <joris> I also don't know how fst works because afaik building minimal automata is hard. It does not do that but it works quite well in practice
jbrown has joined #ocaml
<d_bot> <joris> Reminds me some work project when I was trying to build html efficient rewriting rules from user provided example to be run on a server proxy. Thankfully product realized it was not a cost effective viable product and cancelled the project because i was quite stuck xD
<Fardale> @jktuglu 2.0.5, but that does not matter
<d_bot> <joris> @Drup that is probably a fun project too, generating minimal regex from set of examples
<d_bot> <joris> Already exists but afaik not in ocaml
<d_bot> <Drup> @joris unfortunately, that's (imho) kinda doomed
<d_bot> <joris> Is it? Why?
<d_bot> <jktuglu> Fardale: can I share a repo with you?
neiluj has joined #ocaml
<Fardale> If you want
neiluj has quit [Changing host]
neiluj has joined #ocaml
<d_bot> <Drup> (at least unless there is a good paper that I don't know about on the topic)
<d_bot> <Drup> generating regexs is ... messy ? you can only generate ugly things
<d_bot> <joris> Well you didn't specify beauty was a requirement
<d_bot> <Drup> you did say minimal 🙂
<d_bot> <Drup> afaik, there is no algorithm to "minimize" a regex
hnOsmium0001 has joined #ocaml
<d_bot> <joris> Right. You know I'm an engineer not a theorician. Words don't have the same meaning to me. Minimal means small enough not minimal
<mrvn> Drup: minimal is probably contra productive to beauty
<d_bot> <joris> I just mean that generaging a huge or pattern of all input set is cheating
<mrvn> The problem with regexp made from examples is the same as neural networks that separate cats from dogs. Give it a car as input and watch it output fun.
<mrvn> joris: A huge "or" pattern would only match exactly the examples. That's never what you want or you would have just written an or of all examples.
<mrvn> Drup: how about an algorithm that detects if 2 regexp match the same language?
<d_bot> <Drup> mrvn: is there any other algorithm for that than "generate the minimal DFA and compare for equality" ?
<mrvn> Drup: is THE minimal DFA for a language even a thing? aren't there many?
<mrvn> Drup: I would have thought you would need to do a symbolic evaluation of the regexp and see if they match the same things
<d_bot> <Drup> yeah, IIRC, the minimal DFA is unique
<mrvn> then don't you have your regexp minimizer? Build the minimal DFA and disassemble it
<d_bot> <Drup> yeaah, if you regex engine works like that
<d_bot> <Drup> (`re` doesn't)
mxns has quit [Ping timeout: 240 seconds]
<def> the regex you extract from a DFA is usually much larger than the one used to build it
<def> (afaict, we don't know how to build a small re from a DFA)
<d_bot> <Drup> def: the question was about a small re from a set of strings
<d_bot> <joris> It is probably not what you want to do but I feel like mentioning itsince afaik it was discussed at ocsf (not sure I was not there) and it is something I am currently doing as side projects at work
<d_bot> <joris> Ocaml world heavily heavily lacks small 'by examples' how-to / tutorials for newcommers to explain languages features by use case and patterns to use them
<d_bot> <Drup> I'm not very good at those, unfortunately
<d_bot> <joris> Currently working on some 'modules and functors by example' and 'phantom types in practice' for instance
<d_bot> <joris> Well idk. Your blog post on diff list (iirc? I forgot) was a gem
<d_bot> <joris> Anyway gtg
<d_bot> <Drup> yeah, but it was specific enough
<d_bot> <Drup> def: I read the TDFA article today
<d_bot> <joris> Yeah but it does not need to be generic
<d_bot> <Drup> I would need some prompt, really, like "here is combination of feature X Y Z that I don't really understand"
narimiran has quit [Ping timeout: 260 seconds]
<d_bot> <joris> I think this is one way to approach it. But the other way is 'look I build this fully typed stuff, I used this language feature because it brings that and it works like this. I could also have used that but it would have been less good because blabala'
<d_bot> <joris> It does not need to be driven by concept. It can be driven by use case
<d_bot> <wtetzner> Is there a way to reference the signature described by an `.mli` file by name elsewhere?
<d_bot> <joris> No. Usually you put common signatures in ml files for this reason
<d_bot> <wtetzner> OK, thanks
mmohammadi9812 has joined #ocaml
<def> Drup: so ok, and what do you think?
<mrvn> joris: I thouhgt you could reference the interface of a one module in the mli file of another now
<d_bot> <Drup> TDFA is really nice, it's clearly "heavy-duty" (it's a thomson-like construction, plus determinisation/minisation), but I like the general approach
amiloradovsky has quit [Remote host closed the connection]
<d_bot> <Drup> amusingly, the final form is almost a register automaton
amiloradovsky has joined #ocaml
<def> and the method doesn't seem applicable to a derivative approach :P?
<d_bot> <Drup> Unclear. 🙂
<d_bot> <Drup> In particular, the final determinisation does some fairly fancy things with epsilon-transitions and registers. It also has 2 variations, one with 0-lookahead, and one with 1-lookahead (which is better)
<mrvn> Drup: I think 1-lookahead is worse but more usefull
<mrvn> appropo lookahead: Is there a parser generator with configurable N-lookahead?
<mrvn> or one that looks at the grammar and says: Ok, this needs N-lookahead?
<d_bot> <Drup> for LL, yes
<d_bot> <Drup> for LR .... not that I know of, but IIRC, LR(N) for N >= 1 is not that useful
<d_bot> <Drup> for TDFA, 1 lookahead is clearly significantly more efficient in practice. The expressivity doesn't change
<mrvn> is LL(0) or LR(0)?
Haudegen has quit [Read error: Connection reset by peer]
Hrundi_V_Bakshi has joined #ocaml
Haudegen has joined #ocaml
<d_bot> <Drup> is what ?
<mrvn> useful
<mrvn> Not sure how you would write a grammar in LL(0) or LR(0) that has "if then" and "if then else"
<d_bot> <Drup> I'll let def answer that one 🙂
neiluj has quit [Remote host closed the connection]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
<d_bot> <jit> LL(0)?
<d_bot> <jit> never heard of it lol
mxns has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
amiloradovsky has quit [Ping timeout: 244 seconds]
jnavila has quit [Quit: Konversation terminated!]
<haesbaert> ??snakebite
tane has quit [Quit: Leaving]
jbrown has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml