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
ollehar has quit [Ping timeout: 244 seconds]
ollehar has joined #ocaml
TC01 has quit [Ping timeout: 256 seconds]
TC01 has joined #ocaml
mipri has left #ocaml [#ocaml]
ransom has quit [Quit: Textual IRC Client: www.textualapp.com]
ldbeth has joined #ocaml
ldbeth has quit [Remote host closed the connection]
ldbeth has joined #ocaml
TC01 has quit [Ping timeout: 260 seconds]
TC01_ has joined #ocaml
spew has quit [Quit: Connection closed for inactivity]
mfp has quit [Ping timeout: 244 seconds]
reynir has quit [Ping timeout: 244 seconds]
reynir has joined #ocaml
kleisli_ has quit [Ping timeout: 244 seconds]
kleisli_ has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
ldbeth has quit [Ping timeout: 258 seconds]
ldbeth has joined #ocaml
inkbottle has quit [Quit: Konversation terminated!]
inkbottle has joined #ocaml
ldbeth has quit [Ping timeout: 244 seconds]
ldbeth has joined #ocaml
ldbeth has quit [Ping timeout: 256 seconds]
ldbeth has joined #ocaml
ldbeth has quit [Ping timeout: 260 seconds]
inkbottle has quit [Read error: Connection reset by peer]
ldbeth has joined #ocaml
inkbottle has joined #ocaml
ldbeth has quit [Ping timeout: 244 seconds]
ldbeth has joined #ocaml
ldbeth has quit [Ping timeout: 258 seconds]
ldbeth has joined #ocaml
ldbeth has quit [Ping timeout: 240 seconds]
borne has quit [Ping timeout: 244 seconds]
ldbeth has joined #ocaml
shinzo has joined #ocaml
borne has joined #ocaml
ldbeth has quit [Ping timeout: 256 seconds]
ldbeth has joined #ocaml
ldbeth has quit [Ping timeout: 264 seconds]
ldbeth has joined #ocaml
ldbeth has quit [Ping timeout: 240 seconds]
ldbeth has joined #ocaml
mbuf has joined #ocaml
ldbeth has quit [Ping timeout: 240 seconds]
osa1 has joined #ocaml
ldbeth has joined #ocaml
narimiran has joined #ocaml
ldbeth has quit [Ping timeout: 240 seconds]
borne has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
kleisli_ has quit [Ping timeout: 244 seconds]
<d_bot> <dj charlie> if you saw some code in this style would you be put off?
<d_bot> <dj charlie> ```let sign_bits = function { priv = Some priv ; _ } -> fun bits ->```
<d_bot> <dj charlie> not sure what to think
<d_bot> <ggole> There's nothing particularly wrong with it? I would wonder why it isn't using the usual sugar for nested `fun`, eg, `let sign_bits {priv = Some priv; _} bits = ...`
<d_bot> <dj charlie> i think it looks scuffed, reason being the message that you're not covering the other case (None)
<d_bot> <dj charlie> 🤔 cheers
<d_bot> <dj charlie> `mign[@@warning "-8"]`
Serpent7776 has joined #ocaml
<d_bot> <dj charlie> might just leave that straight up below match in the let and let it be a day
<d_bot> <ggole> Oh, right. I didn't even think about exhaustiveness.
<d_bot> <dj charlie> lel
<d_bot> <dj charlie> getting too ERLANG like
kleisli_ has joined #ocaml
ggole has joined #ocaml
<d_bot> <darrenldl> random question: what IRC clients do people here use?
<zozozo> I use weechat
mbuf has quit [Ping timeout: 244 seconds]
Tuplanolla has joined #ocaml
kleisli__ has joined #ocaml
bartholin has quit [Ping timeout: 265 seconds]
kleisli_ has quit [Ping timeout: 244 seconds]
<d_bot> <dj charlie> weechat is good and it supports heaps of cap
<d_bot> <dj charlie> crap
mbuf has joined #ocaml
bartholin has joined #ocaml
borne has joined #ocaml
<Serpent7776> irssi here
vicfred has quit [Quit: Leaving]
<d_bot> <dj charlie> anyone know how `#show` in a toplevel is implemented?
<d_bot> <dj charlie> i figured maybe findlib online documentation isn't up to date
<d_bot> <dj charlie> *topfind
<d_bot> <dj charlie> or not
dckc has quit [Ping timeout: 256 seconds]
<d_bot> <dj charlie> thank you!
dckc has joined #ocaml
vicfred has joined #ocaml
inkbottle has quit [Ping timeout: 240 seconds]
zebrag has joined #ocaml
olle has joined #ocaml
jbrown has joined #ocaml
mbuf has quit [Quit: Leaving]
bartholin has quit [Quit: Leaving]
mfp has joined #ocaml
mbuf has joined #ocaml
sarna has joined #ocaml
kleisli has joined #ocaml
kleisli__ has quit [Ping timeout: 256 seconds]
webshinra has quit [Remote host closed the connection]
<d_bot> <ostera> is there a reliable way to distinguish between `x` and `y` at the typetree level for this expression?
<d_bot> <ostera>
<d_bot> <ostera> ```ocaml
<d_bot> <ostera> let f x = fun y -> x + y
<d_bot> <ostera> ```
<d_bot> <ostera> e.g, I'd like to know if the parameter is on the left or right hand side of the binding
<d_bot> <octachron> No the distinction is meaningless `let f x y = ... ` is just some syntactic sugar for `let f = fun x -> fun y -> ..`
<d_bot> <ostera> yeah i was hoping some of that parse info would still be present 😛
Haudegen has quit [Quit: Bin weg.]
<d_bot> <ggole> Hmm, what is that info useful for?
reynir has quit [Ping timeout: 240 seconds]
<octachron> the information was never present even in the parsetree.
<d_bot> <Drup> @ostera what kind of syntactic hack are you trying to encode, so that we can discourage you of nailing your own foot :3
reynir has joined #ocaml
Haudegen has joined #ocaml
<d_bot> <ostera> haha so I'm writing a backend that generates Erlang code
<d_bot> <ostera> and while there _is an idiom_ in OCaml to use `()` as the last argument to prevent something from triggering immediately
<d_bot> <ostera> using `{}` as the last argument isn't very idiomatic Erlang
<d_bot> <ostera> e.g
<d_bot> <ostera> `let f x y () = x + y`
<d_bot> <ostera> doesn't really translate to
<d_bot> <ostera> `f(X, Y, {}) -> X + Y.`
<d_bot> <ostera> or it does but it's wonky
<d_bot> <ostera> so instead I'd like to _uncurry_ as much as I can, until it is obvious you are trying to defer the computation
<d_bot> <ostera> eg `f(X, Y) -> fun () -> X + Y end.` would be the idiomatic erlang way of doing this
<d_bot> <ostera> (which still wouldn't be that common,, so I have my doubts about it)
<d_bot> <ostera> this gets in the way when compiling modules like Seq, that rely on this idiom to build values of a specific type `unit -> 'a`
<d_bot> <ostera> @Drup here's what I've got so far: https://github.com/AbstractMachinesLab/caramel/tree/erlcomp/erlcomp
Haudegen has quit [Quit: Bin weg.]
<d_bot> <ostera> eg:
<d_bot> <ostera>
<d_bot> <ostera> ```ocaml
<d_bot> <ostera> let return x () = Cons (x, empty)
<d_bot> <ostera> ```
<d_bot> <ostera>
<d_bot> <ostera> the signature reads: `return : 'a -> 'a t` where `t = unit -> 'a node`
<d_bot> <ostera> so you're not really supposed to see that there is a last parameter that is a unit 🤔
<d_bot> <Drup> it seems to me you are trying to make a transformation that affects 2 things that are very different
<d_bot> <Drup> this transformation should not affect code generation, but should affect the FFI
<d_bot> <Drup> Whereas, as you described it, it affects everything
<d_bot> <Drup> I suggest you stop trying to delimit exactly which functions are exposed as FFI, and only do weird non-semantic-preserving things for *those*
<d_bot> <Drup> (also, imho, doing an ocaml2erlang compiler from source ocaml is a terrible idea, but that's your prerogative)
<d_bot> <ostera> I'm doing it from the typedtree btw
<d_bot> <Drup> still bad, too high
kleisli has quit [Ping timeout: 240 seconds]
<d_bot> <ostera> you think so? both languages have a tiny shared core
<d_bot> <ostera> and I don't expect to support the full of ocaml
<d_bot> <ostera> just that shared core
<d_bot> <Drup> the typedtree is the opposition of tiny
<d_bot> <ostera> ah, yeah, it may come off as "i'm translating the entire typed tree"
<d_bot> <ostera> i mean there's a subset of the typedtree that I can translate to idiomatic erlang
<d_bot> <ostera> tha's what I'm going for
<d_bot> <Drup> Honestly, I would suggest just doing like jsoo.
<d_bot> <Drup> (you can ... even reuse jsoo's code)
<d_bot> <ostera> yeah, i'd rather have erlang source on the other side 🙂
kleisli has joined #ocaml
<d_bot> <Drup> is the readability of the generated erlang an important point ?
<d_bot> <Drup> (I though bs was an excelent demonstration that this was bs, but Eh.)
<d_bot> <ostera> i'm trying to generate idiomatic erlang, sort of what Reason did for javascript
<d_bot> <ostera> but i'm not married to that idea -- so if it ends up being a little wonky, then that's okay
<d_bot> <Drup> it's going to be wonky, and horribly painful to maintain
<d_bot> <ostera> @Drup I'm skipping for example, the entire object system -- just nope
<d_bot> <Drup> (you know, like bs)
<d_bot> <ostera> mutable records, refs, all of that would be gone as well
<d_bot> <Drup> What's the objective ? is it just for fun ?
<d_bot> <ostera> hm, I guess my theory here is that there's a subset of Erlang that is representable in OCaml, and that can be statically typed -- so if I can go from that subset of OCaml to Erlang, then I have a type-checker for that subset of Erlang 😄
<d_bot> <Drup> Because if it's for serious use, I would go a very different way: I would just make a solid API that allows to install ocaml as a BEAM node and some erlang FFI 🙂
<d_bot> <ostera> i don't know, i'm mostly having fun
<d_bot> <Drup> fair enough ^^'
<d_bot> <ostera> the FFI + foreign node approach would work, but it is definitely not the same (operationally) as just running beam nodes
<d_bot> <Drup> but i think you'll fine that if you take the intersection of ocaml and erlang that can be statically typed, it would be a castrated ML with none of the advantages of erlang :p
<d_bot> <ostera> hahah maybe!
<d_bot> <ostera> most of the advantages that people attribute to Erlang are of its runtime rather than the language itself
<d_bot> <ostera> the language is so tiny -- sooo tiny
<d_bot> <Drup> in any case, my initial remark is still valid: don't do non-semantic-preserving transformations, just mark FFI functions explicitely, and do weird things on those only.
<d_bot> <ostera> cool! i'll keep that in mind
<d_bot> <ostera> do you think you could give me some pointers on the typedtree traversals I've got going on?
<d_bot> <Drup> Sure x)
<d_bot> <Drup> that being said, why not start from lambda ?
<d_bot> <Drup> It should be much easier
<d_bot> <Drup> it's an untyped lambda calculus that should be reasonably erlang-like
<d_bot> <ostera> i wanted to preserve some of the data structures to be able to distinguish them and provide a more idiomatic translation
<d_bot> <ostera> e.g, abstract, unions, records, phantom types, GADTs (still have to figure out how to get those right)
<d_bot> <Drup> well, hm, good luck with that 😂
<d_bot> <Drup> GADTs will be fun :p
spew has joined #ocaml
zozozo has quit [Remote host closed the connection]
webshinra has joined #ocaml
<d_bot> <ostera> yeah
<d_bot> <ostera> Dyalizer doens't quite support many of these things, but if I can encode _some of them_, then I'd be happy
<d_bot> <ostera> e.g `Ok 1 = {ok, 1}`
Haudegen has joined #ocaml
waleee-cl has joined #ocaml
bartholin has joined #ocaml
zozozo has joined #ocaml
mbuf has quit [Quit: Leaving]
osa1_ has joined #ocaml
osa1 has quit [Ping timeout: 240 seconds]
sarna has quit [Quit: Connection closed]
clockish_ has joined #ocaml
pgiarrusso_ has joined #ocaml
strmpnk_ has joined #ocaml
bytesighs_ has joined #ocaml
conjunctive_ has joined #ocaml
wildsebastian_ has joined #ocaml
rfv_ has joined #ocaml
breitenj- has joined #ocaml
SrPx_ has joined #ocaml
rdivyanshu has joined #ocaml
SrPx has quit [Ping timeout: 272 seconds]
rdivyanshu_ has quit [Ping timeout: 272 seconds]
clockish has quit [Ping timeout: 272 seconds]
nkly has quit [Ping timeout: 272 seconds]
conjunctive has quit [Ping timeout: 272 seconds]
rfv has quit [Ping timeout: 272 seconds]
strmpnk has quit [Ping timeout: 272 seconds]
worc3131 has quit [Ping timeout: 272 seconds]
leah2 has quit [Ping timeout: 272 seconds]
pgiarrusso has quit [Ping timeout: 272 seconds]
bytesighs has quit [Ping timeout: 272 seconds]
wildsebastian has quit [Ping timeout: 272 seconds]
breitenj has quit [Ping timeout: 272 seconds]
chripell has quit [Ping timeout: 272 seconds]
clockish_ is now known as clockish
chripell_ has joined #ocaml
strmpnk_ is now known as strmpnk
conjunctive_ is now known as conjunctive
pgiarrusso_ is now known as pgiarrusso
bytesighs_ is now known as bytesighs
wildsebastian_ is now known as wildsebastian
rfv_ is now known as rfv
SrPx_ is now known as SrPx
nkly has joined #ocaml
worc3131 has joined #ocaml
leah2 has joined #ocaml
<d_bot> <linse> heyho, does anyone know how to use the `ppx_bisect` for code coverage, specifically `[@@coverage off]`? I want to exclude some pretty printers from test coverage but the first two alternatives still show up as untested even though I added an attribute to exclude them like so:
<d_bot> <linse> ``` let pp_state ppf s =
<d_bot> <linse> Fmt.string ppf (match s with
<d_bot> <linse> | `Unprovisioned -> "unprovisioned"
<d_bot> <linse> | `Operational -> "operational"
<d_bot> <linse> | `Locked -> "locked") [@@coverage off]```
<d_bot> <linse> (I'm looking at the html output of bisect-ppx-report)
narimiran has quit [Ping timeout: 260 seconds]
cantstanya has quit [Ping timeout: 240 seconds]
cantstanya has joined #ocaml
olle has quit [Ping timeout: 258 seconds]
Haudegen has quit [Quit: Bin weg.]
dckc has quit [Ping timeout: 240 seconds]
dckc has joined #ocaml
kleisli_ has joined #ocaml
kleisli has quit [Ping timeout: 244 seconds]
<d_bot> <Updy> is there away to get Utop inside Vs-code's terminal ? if Yes, can someone please let me know how
<d_bot> <hcarty> It should "just work" from inside vscode's builtin terminal
<d_bot> <hcarty> What issue/error are you getting when you try to run it?
mbuf has joined #ocaml
Haudegen has joined #ocaml
osa1_ has quit [Ping timeout: 256 seconds]
<zebrag> I want to make obvious the type of a function `foo : string -> string`, but type annotations inside the definition of the function are plain ugly.
bartholin has quit [Ping timeout: 265 seconds]
narimiran has joined #ocaml
<flux> zebrag: you can use this style: let foo : string -> string = fun str -> str
<zebrag> Yes, I've just did that; not completely satisfactory though, because you have to rewrite the definition to make use of the `fun` keyword
<zebrag> done*
tane has joined #ocaml
<zebrag> #load "_build/default/bin/opal.cmo";; (utop)
<zebrag> open Opal;;
<zebrag> Error: Unbound module Opal
mbuf has quit [Quit: Leaving]
<zebrag> Using: #directory "_build/default/bin/";; as suggested in http://www.cs.cornell.edu/courses/cs3110/2018fa/textbook/modules/toplevel.html doesn't seem to help
<d_bot> <hcarty> zebrag: You could try using `#load_rec` or use `dune utop bin/opal` if `opal` is a library
<companion_cube> what's wrong with `#require opal`?
<zebrag> companion_cube: `opal` is not here a package, but only a ml file, so I don't think #require would be appropriate?
<companion_cube> oh ok
<companion_cube> #mod_use then?
<zebrag> I thought I compiled it with `dune build ./bin/opal.cmo`, but today that command, which I found in my history, doesn't seem to work
<zebrag> yes, good idea, but because `core` is loaded into my utop, and opal.ml is not using it, #mode_use doesn't work
sepp2k has joined #ocaml
<companion_cube> oh ok :/
<zebrag> I've done `dune rules -m -r|grep -i 'opal.*cmo'` as suggested here: https://github.com/ocaml/dune/issues/395; only available cmo, are strange dune__exe__Opal.cmo
<zebrag> So I don't even know how to easily build opal.cmo using dune
<companion_cube> what if, in your project, you copy opal.ml
<companion_cube> and then use `dune utop`?
<zebrag> yes, I've never tried dune utop, that's an idea I will try;
<zebrag> The following did succeed though:
<zebrag> #load "_build/default/bin/blah-blah/dune__exe__Opal.cmo";;
<zebrag> #directory "_build/default/bin/blah-blah/";;
<zebrag> open Dune__exe__Opal;;
<zebrag> I don't know how I obtained dune__exe__Opal.cmo though
<companion_cube> kind of brutal though
<zebrag> ;)
<companion_cube> another solution is to remove Core from your ocamlinit
<companion_cube> (or put `#require "opal"` before it)
<companion_cube> (err, #mod_use I mean)
<zebrag> ok
ggole has quit [Quit: Leaving]
<d_bot> <hcarty> The duneexe prefix is probably meant to avoid potential naming conflicts
<d_bot> <hcarty> Since modules packed into an executable are not meant, from a dune perspective, to be accessible on their own unless they're extracted into their own library
osa1 has joined #ocaml
<rgrinberg> That's right. In particular, if your executable is called foo and one of the dependencies uses some library called foo, dune will tolerate this naming collision.
osa1 has quit [Quit: osa1]
narimiran has quit [Ping timeout: 240 seconds]
ransom has joined #ocaml
<zebrag> yes, I've also observed that when using the form `(executables (names first_name second_name ...`
<zebrag> then first_name is used to create additional directory level in _build
<zebrag> in the form _build/default/bin/.first_name.eobjs/bytes/dune__exe__second_name.cmo
<rgrinberg> zebrag Yes. That choice is arbitrary however
<rgrinberg> We just want to make sure that every library/executables has its own build directory
<zebrag> So what would be the easiest way to build `opal.cmo`, in order to use it with #load "opal.cmo". Would that be defining a custom rule? (and also removing it from the automatic rules through `(modules (:standard \ opal))`, otherwise it causes an error)
remexre has quit [Quit: WeeChat 2.9]
<rgrinberg> Easiest way is to use dune utop
Serpent7776 has quit [Quit: leaving]
eureton has joined #ocaml
<zebrag> Following your suggestion, this is how I did it:
<zebrag> In dune: (library (name dummy) (module opal))
<zebrag> then: dune utop
<zebrag> then: #load "dummy.cmo";;
<zebrag> open Dummy;;
<zebrag> open Opal;;
<zebrag> And I must add `(modules (:standard \ opal))` in (executables ...)
<zebrag> And that's it
<zebrag> It took me quite some time to figure the exact sequence, but once you know it, it doesn't seem preposterous
eureton has quit [Quit: Simple IRC: The quit option.]
remexre has joined #ocaml
reynir has quit [Ping timeout: 240 seconds]
tane has quit [Quit: Leaving]
reynir has joined #ocaml
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rgrinberg> It's even simpler than that, you shouldn't need the #load "dummy.cmo".
<rgrinberg> And yeah, it's cumbersome that only libraries can be loaded at the moment
<rgrinberg> But in any case, loading binaries into the toplevel has its own problem as you immediately run your binary's main
ransom has joined #ocaml
mfp has quit [Ping timeout: 246 seconds]
mfp has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
Haudegen has quit [Ping timeout: 240 seconds]
ransom has quit [Ping timeout: 240 seconds]
<zebrag> Correct: I don't need the #load "dummy.cmo"
<zebrag> I think the whole thing quite makes sense; only it's not described in so many words in the documentation (if it is described at all)
<zebrag> Anyway, I intentionally put details here so I can come back to it later
<zebrag> Thanks for the help
spew has quit [Quit: Connection closed for inactivity]