Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<d_bot>
<ggole> `ocamlfind query package` will print the path to a package if it is installed and whinge if it is not, but note that packages are not the same as modules
<d_bot>
<octachron> Module are packed within packages. They are essentially never installed directly.
<d_bot>
<MemeMachine420> @octachron thank you I suspected this
<d_bot>
<ggole> You can sort of tell because it says `Core_kernel.Std`; if `Core_kernel` were unbound it wouldn't mention the inner module
<d_bot>
<MemeMachine420> I'm new to OCaml
<d_bot>
<ggole> Bit of a subtlety there
<d_bot>
<MemeMachine420> I could compile somethign with Core_kernel
<d_bot>
<MemeMachine420> it was just an old tutorial I guess
<d_bot>
<ggole> If you have it running in the toplevel you can `#show Core_kernel` to see what is in that module
<d_bot>
<MemeMachine420> hmm I see thanks š
<d_bot>
<MemeMachine420> I'll just open an issue
favonia has quit [Ping timeout: 240 seconds]
mosterdt_ is now known as mosterdt
favonia has joined #ocaml
bartholin has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
favonia has quit [Ping timeout: 256 seconds]
favonia has joined #ocaml
olle has joined #ocaml
favonia has quit [Ping timeout: 240 seconds]
vizard has quit [Ping timeout: 256 seconds]
favonia has joined #ocaml
vizard has joined #ocaml
mbuf has quit [Quit: Leaving]
vizard has quit [Ping timeout: 258 seconds]
vizard has joined #ocaml
waleee has joined #ocaml
waleee has quit [Client Quit]
vizard has quit [Ping timeout: 252 seconds]
waleee has joined #ocaml
vizard has joined #ocaml
favonia has quit [Ping timeout: 256 seconds]
favonia has joined #ocaml
<d_bot>
<roddy> @MemeMachine420 I think you are looking at an old resource, Core/Core_kernel hasn't had a Std submodule for a while. If you're reading Real World OCaml, make sure it's the 2nd edition (URL starts with dev)
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
bartholin has quit [Ping timeout: 265 seconds]
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
bartholin has joined #ocaml
zebrag has joined #ocaml
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
wraithgourd has joined #ocaml
bartholin has quit [Quit: Leaving]
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
eight has quit [Ping timeout: 272 seconds]
eight has joined #ocaml
favonia has quit [Ping timeout: 256 seconds]
favonia has joined #ocaml
favonia has quit [Ping timeout: 240 seconds]
<d_bot>
<MemeMachine420> @roddy yep mb
favonia has joined #ocaml
<d_bot>
<MemeMachine420> I'm looking at some code and I'm not too sure why I'm erring
<d_bot>
<MemeMachine420> ```ocaml
<d_bot>
<MemeMachine420> let find_sub prog name =
<d_bot>
<MemeMachine420> Term.enum sub_t prog |>
<d_bot>
<MemeMachine420> Seq.find_map ~f:(fun s ->
<d_bot>
<MemeMachine420> Option.some_if (Sub.name s = name) (Term.tid s))
<d_bot>
<Splingush> Your `Sub.name s` is a (supposedly) a string, your `name` is a string, but the `=`-operator is taking two ints. So that doesn't match.
<d_bot>
<MemeMachine420> ```
<d_bot>
<MemeMachine420> let main src dst proj =
<d_bot>
<MemeMachine420> let prog = Project.program proj in
<d_bot>
<MemeMachine420> match Option.both (find_sub prog src) (find_sub prog dst) with
<d_bot>
<MemeMachine420> so it takes a cmdline which returns a string
<d_bot>
<MemeMachine420> passes it to main
<d_bot>
<MemeMachine420> which calls find_sub
<d_bot>
<MemeMachine420> so name is for sure a string
<d_bot>
<MemeMachine420> and according to the docs sub.name is a string too
<d_bot>
<Splingush> (Sidenote: this channel is bridged to IRC, and large codeblocks are hard to read there. If you have more code, please put it into a bin.)
<d_bot>
<MemeMachine420> so they're both strings according to the doc but it's actually an int
<d_bot>
<Splingush> Yeah, that seems fine. It just uses the wrong `=`-operator. There are multiple of those, for each type, that only take values of that type.
<d_bot>
<MemeMachine420> oh lol so it's expecitng 2 ints
<d_bot>
<MemeMachine420> but it gets 2 strings?
<d_bot>
<Splingush> So you use the `=`-operator that's for ints, but you want the one for Strings, which is in the `String`-module.
<d_bot>
<MemeMachine420> aaaaa I see
<d_bot>
<MemeMachine420> like it doesn't polymorphically auto choose
<d_bot>
<MemeMachine420> yeah ok
<d_bot>
<Splingush> ye!
<Absalom>
Hi, when using toplevel, I manage to #load "unix.cma" and then #load "threads.cma" (no issue for both commands, I am aware threads being itsel in a dedicated directory), but when I try to use Thread module, I get an "Unbound module Thread" error.
<d_bot>
<MemeMachine420> I guess `Core_kernel.Std` had that previously
<d_bot>
<MemeMachine420> is there any way I could include the polymorphic operator from Core_kernel again?
<d_bot>
<Splingush> I do not know that, sorry. Maybe someone else here does. Cheerio!
<d_bot>
<MemeMachine420> ok thanks :aputhumb:
<d_bot>
<NULL> `let (=) = Stdlib.(=)` should work, Stdlib shouldn't be shadowed by Base
<d_bot>
<MemeMachine420> beautiful that worked
<d_bot>
<thangngoc89> Oh since we are on this topic, Iām surprised why containers shadow (==) as well
<d_bot>
<MemeMachine420> so uhh is there a way to know who is shadowing my operators?
<d_bot>
<thangngoc89> And deprecated it in the process
<d_bot>
<NULL> I don't know the reasons either, but `(==)` is the cause of much confusion for beginners
<d_bot>
<MemeMachine420> I've just read OCaml in 1 hour
<d_bot>
<MemeMachine420> but from rooost and some other functional programming languages
<d_bot>
<MemeMachine420> cuz rust basically stole match/let from OCaml :lmao3d:
<d_bot>
<NULL> @Absalom quick experimentation on my Linux machine showed that `#require "threads.posix;;" works
<Absalom>
Indeed, thanks
favonia has quit [Ping timeout: 256 seconds]
<d_bot>
<Anurag> If you have an `open Core` or an `open Base` the polymorphic comparison operators will be shadowed.
favonia has joined #ocaml
<d_bot>
<Anurag> If you want to bring back polymorphic comparison operators into the global scope for some reason you can open the `Poly` module from `base/core_kernel/core`. I'd recommend using the comparison operators for your specific datastructures/types in most cases.
<companion_cube>
(which was done after Base/Core did it)
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
bartholin has joined #ocaml
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
wraithgourd has quit [Remote host closed the connection]
<d_bot>
<Cyclomatic Complexity> I might just be too tired on a saturday evening, but I don't get the following error: https://pastebin.com/951qmcdX
<companion_cube>
this is not valid syntax
<companion_cube>
oh wow, my bad (!!!!!)
<companion_cube>
but you can't generalise this way
<companion_cube>
what you can do is the equivalent of `(type a. ā¦) ref`
<companion_cube>
by using `type foo = { call: a. a plugin -> a Variable.t }`
<companion_cube>
the quantification must be bounded inside a record
Stumpfenstiel has joined #ocaml
<d_bot>
<Cyclomatic Complexity> I am not sure I understand why
<companion_cube>
well OCaml types cannot contain quantifiers
favonia has quit [Ping timeout: 256 seconds]
<companion_cube>
type _definitions_ are schemes, with universal variables (forall, etc.) but a type expression is quantifier-free
<companion_cube>
`(type a. a foo -> a bar) ref` is a type expression that would contain an explicit quantification
<d_bot>
<Cyclomatic Complexity> but why can't i lift the `type a .` outside the ref?
<d_bot>
<Cyclomatic Complexity> which is what i've written
<companion_cube>
that's not the same type
<companion_cube>
(type a. a foo -> a bar) ref
<d_bot>
<Cyclomatic Complexity> i want `type a . (a foo -> a bar) ref`
<companion_cube>
ah but that's not possible because `ref` is mutable
<octachron>
This type is not possible because mutable variable can never contain polymorphic values.
<companion_cube>
you could have it with list instead of ref, for example
<companion_cube>
imagine for `type a. a option ref`
<companion_cube>
`let r: ā¦ = ref None in r := Some 1; r := Some "foo"`
<companion_cube>
pretty weird no?
favonia has joined #ocaml
<octachron>
In other words, you would allow different readers/writers to have drastically opinion on the type of the contents of the mutable variable.
<companion_cube>
^
<d_bot>
<Cyclomatic Complexity> i see
<d_bot>
<Cyclomatic Complexity> thanks
<d_bot>
<Cyclomatic Complexity> yeah, so the type that i wanted was indeed `(type a. a foo -> a bar) ref`
favonia has quit [Ping timeout: 240 seconds]
<companion_cube>
give a try to the record type above
<companion_cube>
it's relatively classic when doing CPS
<dmbaturin>
companion_cube: I've just realized that TOML is not context free at all. [[false]] can be either a header of an array of tables named "false" or a (bool list list) array, you can't tell without knowing if you are in the value context or top level statement context.
favonia has joined #ocaml
<dmbaturin>
As much as I wanted to avoid lexer hacks, I guess I can't. ;)
<companion_cube>
but there's just 2 different productions then?
<companion_cube>
oh.
<companion_cube>
yeah you probably need to parse `false` as a string.
<dmbaturin>
That's why you should never let people who didn't pass a formal language 101 class design a format.
<d_bot>
<Cyclomatic Complexity> companion_cube: yeah, that's what I did, it works fine. just wondering why it can't be put in an expression directly
<companion_cube>
because with a record you need `myrecord.call` which is a point where the typechecker knows to instantiate a type scheme
<companion_cube>
which it does not in regular function instantiations
<companion_cube>
I don't know the deep reason behind that. I think it helps (a lot) keeping type inference decidable.
<companion_cube>
(or close to decidable(
<companion_cube>
)
<d_bot>
<octachron> Inference for higher-rank polymorphic functions is undecidable. Putting the inner polymorphic function in a box and unboxing explicitly avoids the issue without requiring type annotations on every function using the type.
<d_bot>
<Cyclomatic Complexity> I see, like a type hint for internal foralls