companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.12 released: https://ocaml.org/releases/4.12.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
<Armael> oh, that's cool
<neiluj> brettgilio, great! teaching which subjects?
<brettgilio> I'm certified in Biology, Earth Science, Mathematics, and Comp Sci,
<brettgilio> neiluj
<neiluj> impressive :)
<brettgilio> The big difficulty with OCaml and Racket as an after-school club is the district is really big on Chromebooks
<brettgilio> and I honestly have no idea if/how Chromebooks can run an OCaml environment.
<brettgilio> lol
<brettgilio> So it may have to be VPS-based
<neiluj> arf, tricky stuff
<neiluj> there's learn ocaml
<neiluj> it's an online environment where you can put exercises along with checks, so that students get feedback about their code (how much tests are passing, etc.)
<Corbin> If they were just Chromebooks, then https://github.com/dnschneid/crouton would be an option, but presumably they're *managed* too, which really does restrict the options.
<brettgilio> Corbin My wife's district chromebook allows for a linux-based subsystem of some sort
<brettgilio> so maybe they arent managed strict-enough to prohibit it
<brettgilio> I might have to experiment
<brettgilio> I'm not a fan of VSCode, but maybe https://coder.com/ can fulfill an aim using the ocaml platform
<neiluj> just spreading the word
<neiluj> ;)
<brettgilio> Thanks neiluj :)
<neiluj> yw. It's made by teachers at my uni, plus some very skilled OCaml programmers from company ocamlpro
<neiluj> It was a really nice experience to solve exercises with it
<brettgilio> neiluj do you use Emacs?
<brettgilio> Just curious
<neiluj> sometimes
<brettgilio> What is your go-to OCaml env?
<neiluj> I primarily code with vscode, with the ocaml platform extension
<neiluj> for emacs you can use tuareg+merlin
<brettgilio> Yeah, thats what I use. I was just generally curious about your preferences haha
<brettgilio> Nosiness on my part
<neiluj> yeah, just use whatever you're comfortable with
<neiluj> good night!
waleee has quit [Ping timeout: 250 seconds]
neiluj has quit [Ping timeout: 258 seconds]
<brettgilio> so i'm trying the ocamllabs platform, I am not sure I understand the "sandbox" concept. I have core installed in my switch, for example. But I can't `open Core` without getting a module unbound issue. So I am assuming that the lsp-server still relies on the .merlin file in some way?
<brettgilio> I just think its odd that the sandbox identifies core from the switch but doesnt know to bind it to the environment automatically?
<brettgilio> Unless I am doing something wrong
<drakonis> oh
<drakonis> you are
<drakonis> it is in the environment, but you need to explicitly enable them
<drakonis> if you're using dune, it is a bit easier since you can just declare them on the build files
<brettgilio> is there a way to enable them without using dune (like by interacting with the lsp through vscode directly? a command I suppose)
<brettgilio> in emacs there is a use-module through merlin
<brettgilio> something similar to that
<drakonis> this looks like what's going on
<drakonis> same circumstances
<drakonis> dune is a build system, mind you
<drakonis> although i'm sure i'm already telling you something you already now
<drakonis> know
<brettgilio> Right. I've got the dune side of it figured out. That is all swell. But for one-off module loading without using dune, what solution is there?
<brettgilio> Like utop has #require
<drakonis> hmm
<brettgilio> merlin in emacs has use-module
<brettgilio> but without having to add the dependency to the dune build manifest, what do we do?
<brettgilio> (this could very well just be that im not experienced in vscode at all)
<drakonis> findlib maybe?
<drakonis> i think i recall reading something about finally making it easier to load modules
<brettgilio> Findlib sounds right, but unfortunately the platform doesnt list it :)
<drakonis> this is what you need
<drakonis> rather
<drakonis> ocamlfind
<brettgilio> ah yes, I forgot that existed
<brettgilio> alrighty, im off to bed. Night everybody
<drakonis> hmm
<drakonis> looks like dune is probably the better way to go
<brettgilio> agree with you
<drakonis> there seems to be some work towards making it easier to manage libraries
<brettgilio> thanks drakonis. cheers
<brettgilio> ive bookmarked for read tomorrow
zebrag has quit [Quit: Konversation terminated!]
<Corbin> I'm using Djinn, the Haskell tool, to figure out some nasty OCaml expressions. I don't feel bad about this, but are there similar tools better suited to OCaml?
mbuf has joined #ocaml
<companion_cube> No one is using parametricity :)
<companion_cube> Well, there's nothing equivalent I think. You may be trying to write Haskell disguised as OCaml
<Corbin> I am definitely shopping for a compiler and runtime, it seems. I was idly considering looking into some Lisp compilers, too.
gzj has joined #ocaml
<Corbin> I tried manually CPS'ing a bunch of code. It hasn't gone well. It would be way better if a compiler were doing it.
gravicappa has joined #ocaml
gzj has quit [Quit: Leaving]
ansiwen has joined #ocaml
berberman has joined #ocaml
berberman_ has quit [Ping timeout: 240 seconds]
<companion_cube> Chez scheme ?
<Corbin> I'm thinking of trying both Chez and Chicken. I don't know a whole lot about writing portable Scheme, so this'll be new.
malc has joined #ocaml
wilfred has joined #ocaml
nd__ has joined #ocaml
malc has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
Serpent7776 has joined #ocaml
<d_bot> <atsignhandle> Is there a preferred channel to post or ask if anyone is looking for work - obviously having to do with OCaml and blockchain stuff - extra points if you can guess the rest. DM me.
mro has joined #ocaml
bartholin has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
glassofethanol has joined #ocaml
malc has joined #ocaml
<Fardale> @atsignhandle discuss can be use to post job offers.
<Fardale> brettgilio: You need to declare the package that you want to use in the .merlin file: https://github.com/ocaml/merlin/wiki/project-configuration
wilfred has quit [Quit: Connection closed for inactivity]
mro has joined #ocaml
malc has quit [Ping timeout: 240 seconds]
average has quit [Quit: Connection closed for inactivity]
mro has quit [Remote host closed the connection]
kakadu has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 258 seconds]
<d_bot> <Ulugbek> re: .merlin configuration
<d_bot> <Ulugbek> If you use `dune`, you don't need to write `.merlin` config files manually. `dune` and `merlin` communicate with each other, and `dune` passes `.merlin` to melrin directly.
mro has joined #ocaml
<Fardale> The question was how to do it without dune. I should have mention that in my answer
<d_bot> <Ulugbek> > so i'm trying the ocamllabs platform, I am not sure I understand the "sandbox" concept. I have core installed in my switch, for example. But I can't open Core without getting a module unbound issue. So I am assuming that the lsp-server still relies on the .merlin file in some way?
<d_bot> <Ulugbek> Sandbox is basically an opam switch. You can set it by calling command "OCaml: Select Sandbox for this Workspace" or clicking on the package icon at the bottom of vscode. For example, I pick the switch `4.12.0`, where ocaml-lsp-server is installed along with other packages I use, and vscode OCaml Platform automatically runs the language server from that switch.
<d_bot> <Ulugbek>
<d_bot> <Ulugbek> Regarding "module not found", are you sure you indicated that your library/executable depends on "core"? Just installing a package, doesn't make it available for use. Your dune file for a library would look like
<d_bot> <Ulugbek>
<d_bot> <Ulugbek> ```
<d_bot> <Ulugbek> (library
<d_bot> <Ulugbek> (name my_lib)
<d_bot> <Ulugbek> (libraries core))
<d_bot> <Ulugbek> ```
<d_bot> <Ulugbek>
<d_bot> <Ulugbek> OCaml Platform extension offers a snippet `library` that can generate that for you.
malc has joined #ocaml
malc has quit [Remote host closed the connection]
malc has joined #ocaml
waleee has joined #ocaml
average has joined #ocaml
PinealGlandOptic has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
kevinsjoberg has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot> <KevinSjoberg> 👋
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Ping timeout: 250 seconds]
nd__ has quit [Ping timeout: 258 seconds]
malc has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
mro has joined #ocaml
nd__ has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
neiluj has joined #ocaml
mro has quit [Ping timeout: 276 seconds]
<neiluj> Hello! Trying to extend a set with a functor, but somehow it's not found: https://bpa.st/TL2A
<neiluj> Set1 is not found at line 15
mro has joined #ocaml
<octachron> Set1 is at the expression level, and there is indeed no constructor named Set1 in scope.
<neiluj> hmmm, so maybe put the functor S1 in the function make_set?
<neiluj> or better yet, no need for a functor Set1, just include Set and call Set1.Make?
<neiluj> arf no, the Set1 would escape its scope
<octachron> no? You can just compute at the module with `let module S = Set1 ... in (module S)`
<octachron> But with the current type constraints you are hiding the function added by the functor.
<neiluj> yeah, it gets too tricky, is there maybe a simpler way to achieve this?
mro has quit [Remote host closed the connection]
Tuplanolla has joined #ocaml
<octachron> I am not sure what you mean by "this".
<octachron> Locally, you could define a `Make1` function that creates a `Set` module with your extended signature.
favonia has joined #ocaml
<neiluj> Right, extend the Set module with a take function, then write a function that builds an "extended" set with the take and comparison functions.
<neiluj> oh, that seems doable, going to try it, thanks!
mro has joined #ocaml
mro has quit [Remote host closed the connection]
average has quit [Quit: Connection closed for inactivity]
mbuf has quit [Quit: Leaving]
<neiluj> octachron, made some progress! https://bpa.st/XZ4A
<neiluj> still, it's not possible to pass the take function to the Ord module required by the Make functor
<neiluj> is there a way to "inject" this take function into the Set1?
<neiluj> or to be more precise, define
<octachron> You need to redefine the `Make` functor in `Set1` and add the `take` function here rather than adding the `take` function to the `Ord` argument.
<neiluj> oh, makes sense, thanks
<neiluj> hmm, how would you pass the take function to a new Make1 functor? naively I'd copy the definition of Set.Make and then add the take function
<neiluj> Maybe with a new module?
mro has joined #ocaml
<octachron> "struct include Set.Make(Ord) let take ... end"
<neiluj> yay: https://bpa.st/THRA
<neiluj> oh indeed :)
<neiluj> thanks!
<neiluj> fun stuff
glassofethanol has quit [Quit: leaving]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<neiluj> wow, the ability to parametrize modules makes for succinct code!
<neiluj> it's beautiful
<companion_cube> it can be cool, yues
<companion_cube> yes
waleee has quit [Ping timeout: 256 seconds]
mbuf has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
nd__ has quit [Ping timeout: 276 seconds]
mbuf has quit [Quit: Leaving]
nd__ has joined #ocaml
arbipher has joined #ocaml
arbipher has quit [Quit: Client closed]
mro has quit [Remote host closed the connection]
berberman_ has joined #ocaml
arbipher has joined #ocaml
berberman has quit [Ping timeout: 256 seconds]
arbipher has quit [Client Quit]
arbipher has joined #ocaml
<brettgilio> Something I do not quite understand is how dot-merlin-reader works. After dune completes building, I do not see .merlin files in any of the source directories. How is merlin/dune reading the library module locations?
<companion_cube> Merlin and dune communicate via a rpc system now
<brettgilio> companion_cube, do you know of any documentation or explanation for this system?
<companion_cube> There was a discuss announcement about it
<companion_cube> Not sure how documented it is though.
<brettgilio> will check the discuss
<brettgilio> thanks
<brettgilio> Thanks Ulugbek
<d_bot> <Ulugbek> Code in merlin that deals with `.merlin` protocol: https://github.com/ocaml/merlin/tree/master/src/dot-merlin
PinealGlandOptic has left #ocaml [#ocaml]
<d_bot> <monk> `sep` and every function after `>>` are themselves parser combinators that return a `('token, 'result) parser`. what i am wondering is there anyway to refactor the `fun x -> ....` pattern that i keep using on the right hand side of the monad operator?
<d_bot> <monk> i didn't post a snippet per the description of #general
<d_bot> <monk> i don't know how i pass/capture the knowledge of the specific tag to be matched that i currently do
<d_bot> <monk> i.e `Symbol` vs `Str` vs `Ident` and so on
<d_bot> <monk> i think i realized my solution... maybe
<d_bot> <monk> make a parser for each enum tag, so `str` for `Str` that just does that right hand side work
<d_bot> <Christophe> at the very least have you considered `map` instead of `bind` to avoid the return?
<d_bot> <monk> oh lol
<d_bot> <monk> thank you
<d_bot> <monk> that's a pattern i totally forgot about
<d_bot> <Christophe> then you can probably (assuming here that `map` is `>>|`) do `sep >> indent >>| implode >>| ident` if you have defined `let ident x = Ident x` the "smart constructors"
<d_bot> <Christophe> oh wait there's a name conflict there
<d_bot> <Christophe> but general idea
<d_bot> <monk> yeah your idea is generally what i needed, i think
<d_bot> <monk> thank you
gravicappa has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
tjammer has joined #ocaml
<d_bot> <monk> so the small lib i was using provided `=>` as map and i defined another `=|` that ignores the result and maps (i know the token i want) and here's the result thus far
<d_bot> <monk> definitely feels cleaner
tjammer has quit [Ping timeout: 240 seconds]
tjammer has joined #ocaml
<neiluj> indeed, looks like haskell :p
<d_bot> <monk> 😅
<companion_cube> @monk don't use => as map
<companion_cube> it's a terrible idea
<d_bot> <monk> confusion with a comparison operator?
<companion_cube> yes
<companion_cube> and probably wrong associativity, too
<d_bot> <monk> wait, so the choice in characters used for defining an operator also affects the associativity?
<Fardale> If I remember correctly associativity is defined by an ordering on the characters
<d_bot> <monk> oh dang
<companion_cube> the first char, yes
<d_bot> <monk> yeah
<d_bot> <monk> did not realize
<d_bot> <monk> companion_cube, what type of associativity does one want for a monadic map?
<d_bot> <monk> tangent but now i'm curious
<companion_cube> right assoc, I think
<companion_cube> but I'd just use `let+` now
mro has joined #ocaml
nd__ has quit [Ping timeout: 245 seconds]
waleee has quit [Quit: WeeChat 3.2]
nd__ has joined #ocaml
waleee has joined #ocaml
darxun has joined #ocaml
mro has quit [Ping timeout: 258 seconds]
nd__ has quit [Ping timeout: 250 seconds]
mro has joined #ocaml
mro has quit [Quit: Leaving...]
Serpent7776 has quit [Quit: leaving]
nd__ has joined #ocaml
tjammer has quit [Quit: terminated!]
nd__ has quit [Ping timeout: 276 seconds]
bartholin has quit [Quit: Leaving]
nd__ has joined #ocaml
nd__ has quit [Ping timeout: 240 seconds]
neiluj has quit [Quit: Leaving]
nd__ has joined #ocaml
nd__ has quit [Ping timeout: 272 seconds]
Tuplanolla has quit [Quit: Leaving.]
Nahra has joined #ocaml
<d_bot> <monk> hnnnn
<d_bot> <monk> i feel like i'm getting close on this dang parser
<d_bot> <monk> https://bpa.st/3CNA
<d_bot> <monk> so i know my `read_list` function isn't right, but i don't know how to proceed per-se
<d_bot> <monk> i get the following error:
<d_bot> <monk> ```
<d_bot> <monk> File "lib/reader.ml", line 57, characters 2-12:
<d_bot> <monk> 57 | form input
<d_bot> <monk> ^^^^^^^^^^
<d_bot> <monk> Error: This expression has type (char, malval) parser
<d_bot> <monk> but an expression was expected of type (char, malval list) parser
<d_bot> <monk> Type malval is not compatible with type malval list ```
<companion_cube> can you use a paste website please?
<companion_cube> well check where you use the Error case
<d_bot> <monk> did my paste link not make it through? here it is again: https://bpa.st/3CNA