companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vicfred has quit [Quit: Leaving]
<brettgilio> Informal survey. What OS/Distribution are you all using for OCaml work?
<d_bot> <Anurag> I'm on macOS and most of my OCaml work happens on 4.14 version of the compiler (with some 4.13)
Tuplanolla has quit [Quit: Leaving.]
dh` has joined #ocaml
<companion_cube> brettgilio: arch, with 4.12
<d_bot> <NULL> Manjaro, I don't put a version restriction for ocaml in my switch invariant
<companion_cube> (I have tons of switches, btw)
spip has joined #ocaml
bobo has quit [Read error: Connection reset by peer]
<d_bot> <cod1r> hi
hsw has joined #ocaml
shawnw has quit [Ping timeout: 256 seconds]
waleee has quit [Ping timeout: 260 seconds]
zebrag has quit [Quit: Konversation terminated!]
<companion_cube> so, do we not have any library that implements SHA and has jsoo stubs? :/ :/
<companion_cube> can't find anything
<d_bot> <Anurag> @companion_cube digestif has a pure OCaml implementation that can be linked against. Maybe that'll work with jsoo out of the box?
<companion_cube> I mean sure, but yikes
<companion_cube> maybe the web crypto APIs are too limited? :/
vicfred has joined #ocaml
<d_bot> <Muqiu-Han> Arcolinux
<d_bot> <nave01314> Mac; 4.14
gravicappa has joined #ocaml
Haudegen has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 246 seconds]
kaph has quit [Ping timeout: 260 seconds]
<d_bot> <Ambika E.> Arch with 4.13 to 5.0
vicfred has quit [Ping timeout: 256 seconds]
<gopiandcode> Heya all!
<gopiandcode> Does anyone know if OCaml's internal typing module is meant to be dependent on the ast having correct location information
<gopiandcode> I'm running into some spooky behaviour where an AST constructed using Ast_helper fails to type check
<gopiandcode> while if I print and then parse the ast, it then type checks
<gopiandcode> ?
<gopiandcode> any ideas?
<sim642> I don't think the location information should matter for that, but I recently also discovered that it's possible to construct parsetrees (in a ppx) which are supposedly invalid and may fail to typecheck: https://github.com/ocaml/ocaml/issues/11129
<sim642> In my case also, the printout was fine because the parsetree printer actually tries to be clever and not print empty polymorphic binders
gravicappa has quit [Ping timeout: 256 seconds]
<gopiandcode> ah, interesting, so it could be a problem with the ast I'm constructing
<gopiandcode> in my case, the error seems to just be that the typechecker complains about Array.make being an unbound value when it is indeed in the type context
<gopiandcode> but that's a good pointer - it could be that my function application is itself somehow an incorrect ast
<gopiandcode> ah, yup, thanks sim642, that was indeed the problem, my AST was not encoding Longidents correctly
<sim642> Putting literal dots in Lident strings instead of Ldot or whatever it is?
<gopiandcode> yes exactly
<gopiandcode> it was a simple fix, and now things work again
mro has joined #ocaml
gravicappa has joined #ocaml
cedric has joined #ocaml
<Anarchos> gopiandcode by the way, how do you look and modify your Ast ? I never did such things
<gopiandcode> the Pprintast module makes it easy to print out asts
<gopiandcode> I use Ast_helper to create asts/make combinator functions to make it easy to create asts
<Anarchos> i suppose they are standard modules of the compiler ?
<Anarchos> do you use them in toplevel ?
<gopiandcode> yes, they are modules from compiler-libs
<gopiandcode> in particular ocaml-compiler-libs.common
<gopiandcode> they should work in the toplevel as well, although I'm personally not using it
<Anarchos> gopiandcode ok you call them from your own source :)
<gopiandcode> yes, I'm currently just using them directly in my source file
<Anarchos> gopiandcode thanks for your explanation
<gopiandcode> no problem Anarchos
mro has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
olle has joined #ocaml
Anarchos has joined #ocaml
kaph has joined #ocaml
mro has joined #ocaml
bartholin has joined #ocaml
Anarchos has quit [Remote host closed the connection]
Anarchos has joined #ocaml
mro has quit [Read error: Connection reset by peer]
mro_ has joined #ocaml
gravicappa has quit [Ping timeout: 248 seconds]
mro_ has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
* Anarchos will try to compile ocaml on its new core i3 dual core :)
wingsorc 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
mro_ has joined #ocaml
mro has quit [Ping timeout: 246 seconds]
Haudegen has quit [Quit: Bin weg.]
mro_ has quit [Read error: Connection reset by peer]
mro has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
sagax has joined #ocaml
brettgilio has quit [Quit: The Lounge - https://thelounge.chat]
herlocksholmes has quit [Quit: The Lounge - https://thelounge.chat]
herlocksholmes has joined #ocaml
brettgilio has joined #ocaml
<olle> "new" i3?
<olle> "new" "dual"? :)
Haudegen has joined #ocaml
<d_bot> <idnes> some nice ocaml codebase to read for a beginner?
<haesbaert> olle: 12th gen i3 has 2 "fast" cores and 4 "slow"
<olle> haesbaert: oh
<olle> 12th gen?
<companion_cube> didn't even realize they were still making i3
* olle It's time for the Intel. To die.
<haesbaert> companion_cube: cost/benefit is still pretty good
mbuf has joined #ocaml
<companion_cube> good to know indeed!
szkl has joined #ocaml
<d_bot> <Anurag> olle: Intel still has the best tracing tools.Tools like<https://github.com/janestreet/magic-trace> make a really good case for picking intel.
kaph has quit [Ping timeout: 260 seconds]
<companion_cube> yeah it's crazy
<companion_cube> first time I've thought "hu, intel is actually ahead" in a while
spip has quit [Ping timeout: 246 seconds]
bobo has joined #ocaml
chrisz has quit [Ping timeout: 240 seconds]
<olle> Anurag, tracing what?
<companion_cube> look at the magic-trace thing, it's mind blowing
<olle> Oh, not ray tracing :)
chrisz has joined #ocaml
<d_bot> <Anurag> sorry the term is confusing as there are many kinds of tracing 😄 What companion_cube said, I was referring to tracing what a process does. magic-trace repo has some examples, but its really nice to be able to probe a process without having to manually instrument/recompile an application
<companion_cube> just for a few ms though, if you don't want to get GB-sized traces
<companion_cube> it's so detailed
<companion_cube> (but then you do see the GC!!)
<olle> Ooooh
<d_bot> <Bluddy> and page faults
vicfred has joined #ocaml
mro has quit [Remote host closed the connection]
Anarchos has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
<d_bot> <mbacarella> kind of. I'm trying to find dead code quickly
mro has joined #ocaml
mro has quit [Remote host closed the connection]
gravicappa has joined #ocaml
bobo has quit [Ping timeout: 240 seconds]
bobo has joined #ocaml
mro has joined #ocaml
vicfred has quit [Quit: Leaving]
Haudegen has quit [Quit: Bin weg.]
<d_bot> <idnes> whaaaaaaaaaaat
<d_bot> <Ambika E.> What's up?
szkl has quit [Quit: Connection closed for inactivity]
<d_bot> <idnes> fancy
<d_bot> <idnes> https://youtu.be/-J8YyfrSwTk?t=3729 its around here
<d_bot> <idnes> and ive been wondering: why not make it t rw or t ro
cedric has joined #ocaml
zebrag has joined #ocaml
<d_bot> <NULL> If you see it as a type parameter, they go on the left in OCaml
bartholin has quit [Quit: Leaving]
<d_bot> <idnes> @NULL but would it be legal to put it on the right as well? i mean, while breaking some stylistic convention?
<d_bot> <NULL> rw and ro are type-level tags, so you have to manipulate types which is a bit mind-bending
<d_bot> <NULL> I'm trying to imagine what it would look like to define it as `t rw` but I haven't found something yet
<d_bot> <idnes> hmm
<d_bot> <NULL> Ok, you wouldn't be able to define `get : 'a t -> int` so this is strictly less practical
<d_bot> <NULL> Otherwise, just define `type 'a rw = 'a` and hide it in the interface
<d_bot> <idnes> 🤔
olle has quit [Ping timeout: 256 seconds]
mro has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
olle has joined #ocaml
Haudegen has joined #ocaml
mbuf has quit [Quit: Leaving]
<d_bot> <Ambika E.> Huh
<d_bot> <Ambika E.> I'm not sure what you even mean by this
<d_bot> <Ambika E.> In practice rw t and t rw mean totally different things
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
Anarchos has quit [Ping timeout: 256 seconds]
<d_bot> <NULL> Yes they do, hence why I had to look into it. Tags are just that, so you can try to make it work the way you want. Here it wouldn't be as handy though
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
Anarchos has joined #ocaml
genpaku has quit [Ping timeout: 240 seconds]
szkl has joined #ocaml
genpaku has joined #ocaml
shawnw has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
Tuplanolla has joined #ocaml
kaph has joined #ocaml
vicfred has joined #ocaml
mro has joined #ocaml
vicfred has quit [Quit: Leaving]
<d_bot> <idnes> explain pls?
<d_bot> <Ambika E.> have you written any other language, like java or C# or C++? @idnes
<d_bot> <idnes> yeah
<d_bot> <idnes> ruby and c
<d_bot> <Ambika E.> hm
<d_bot> <Ambika E.> i guess neither of those have generics the way object oriented languages tend to
<d_bot> <idnes> well, i do understand generics, kind of, if thats what you need..
<d_bot> <Ambika E.> sure
<d_bot> <Ambika E.> take for example List<Int>
<d_bot> <Ambika E.> this is `int list` in OCaml
<d_bot> <idnes> mhm
<d_bot> <idnes> yeah
<d_bot> <Ambika E.> `list int` in OCaml would be like `Int<List>`
<d_bot> <Ambika E.> which is definitely different
<d_bot> <idnes> true...
<d_bot> <Ambika E.> it's the same thing really
<d_bot> <Ambika E.> these can'
<d_bot> <Ambika E.> one of these types is being constrained by the other
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d_bot> <idnes> hm
<d_bot> <idnes> though in this case its more like `Rw<Int>` or `Int<Rw>`
<d_bot> <Ambika E.> well
<d_bot> <Ambika E.> there is a type t
<d_bot> <Ambika E.> so what we have is
<d_bot> <Ambika E.> T<Rw>
<d_bot> <Ambika E.> t is being constrained by rw
<Corbin> idnes: FWIW this is called "phantom typing"; the types `rw` and `ro` don't add any functionality to the generic interface, but the typechecker is forced to make them distinct.
mro_ has joined #ocaml
<Corbin> Or, more accurately, `rw` and `ro` are called "phantom types". No special feature of the typesystem is required to make this work; it's not a special typing judement.
<d_bot> <idnes> thanks corbin, i indeed became aware of it with that name, but im still a bit confused about that directionality
<d_bot> <Ambika E.> the directionality is just a syntax rule
<d_bot> <idnes> or we could have a generic Rw that is "defined" for T Rw
<d_bot> <idnes> would that be invalid?
<d_bot> <Ambika E.> well
<d_bot> <Ambika E.> it's simply the case that we don't have that here
<d_bot> <Ambika E.> if you defined `Rw` as a generic type then sure, that could work, but i don't think that's what's going on here
<d_bot> <Ambika E.> similarly, if `Int` was generic over some T, then supposedly you could have `Int<List>`, but i don't think that makes much practical/meaningful sense
asm has joined #ocaml
asm has quit [Changing host]
mro has quit [Ping timeout: 260 seconds]
<d_bot> <idnes> granted. i was just wondering if the other approach would be wrong or something
<d_bot> <Ambika E.> wrong in what sense
<d_bot> <Ambika E.> this is just one of those situations where if u switch things around u get something thats syntactically valid but means something completely different
<d_bot> <Ambika E.> in that sense it's "wrong"
<d_bot> <idnes> i dont know...
<d_bot> <idnes> i suppose
<d_bot> <idnes> `val ro : rw t -> ro t` and `val ro : t rw -> t ro`
<d_bot> <idnes> could be used to achieve the same functionality?
<d_bot> <Ambika E.> this doesn't really make sense
<d_bot> <Ambika E.> like i said, swapping the positions of `rw` and `t` or `ro` and `t` make for a different meaning altogether
<Corbin> The first version implies `type 'a t = ...` but the second version implies `type 'a ro = ...` and `type 'a rw = ...`
<d_bot> <idnes> ;-;
<d_bot> <Ambika E.> i feel like maybe this is confusing because it's not clear what `rw`, `ro`, and `t` are or what they represent
<d_bot> <idnes> maybe...i dont quite follow that
<d_bot> <idnes> corbin, why `type 'a t` and not `type ro t` and `type rw t`?
<d_bot> <Ambika E.> when the type `t` was defined
<d_bot> <Ambika E.> it was defined as `'a t`
<d_bot> <Ambika E.> `'a` is the generic type variable
<d_bot> <Ambika E.> `t<'a>` in traditional/oo syntax
<d_bot> <orbitz> Do you mean `val ro : rw t -> ro t`?
<d_bot> <RegularSpatula> I remember this from a JS blog post…rw is read/write, ro is read only
<d_bot> <Ambika E.> i see
<d_bot> <Ambika E.> their confusion is about the interchangeability of `rw t` and `t rw`
<d_bot> <Ambika E.> as one example
<d_bot> <idnes> does that change anything?
<d_bot> <orbitz> @idnes can you describe your confusion?
<d_bot> <idnes> perhaps i do understand it now... i was mainly confused whether or not it would work, if it was done the other way around
<d_bot> <idnes> when there are phantom types, why is `rw t` as a type used, and not `t rw`
<d_bot> <orbitz> Because that is the syntax of ocaml
<d_bot> <idnes> maybe in a more traditional/oo as ambika said: why is `t<rw>` preferred over `rw<t>`
<d_bot> <octachron> Rather it is because `rw t` would be a phantom type constructor.
<d_bot> <octachron> If you have either `rw t` or `ro t`, you can define function that acts on both by giving them an `'a t` argument
<Corbin> Because `rw` doesn't have any interesting content or internal structure. It's just a tag; it's a one-element type, I think.
<d_bot> <octachron> where `'a` can be either `rw` or `ro` since the argument is parameter of the type `t`.
<d_bot> <orbitz> I think the question is just about syntax. But I'm not sure
<d_bot> <octachron> No if you have a `t rw`, it term of types, you could write function that takes any `'a rw` as argument ... Except that don't work in term of implementation.
<d_bot> <idnes> maybe thats a plausible reason
<d_bot> <octachron> Because if I give you a `'a rw` you only know that I have decided to tag some type as read-or-write without knowing anything about what is the type type `'a`. You are then stuck.
<d_bot> <octachron> Moreover, you cannot any more write function that takes either a `t rw` or `t ro` because it requires to have a function that is polymorphic on the type constructor `rw` or `ro` which is not possible without functors in OCaml.
<d_bot> <idnes> oh ok
<d_bot> <idnes> makes sense i suppose
<d_bot> <idnes> thanks
tiferrei has joined #ocaml
gravicappa has quit [Ping timeout: 248 seconds]
szkl has quit [Quit: Connection closed for inactivity]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
mro_ has quit [Quit: Leaving...]
Tuplanolla has quit [Quit: Leaving.]
wingsorc has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
rgrinberg has joined #ocaml
tiferrei has quit [Ping timeout: 240 seconds]
tiferrei has joined #ocaml
kaph has quit [Ping timeout: 260 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
waleee has joined #ocaml
olle has quit [Ping timeout: 276 seconds]
Haudegen has quit [Ping timeout: 276 seconds]
tiferrei has quit [Ping timeout: 240 seconds]
tiferrei has joined #ocaml
rgrinberg has quit [Ping timeout: 248 seconds]