companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.05.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.05/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
mengu has quit [Read error: Connection reset by peer]
xuanrui has quit [Quit: Leaving]
mengu has joined #ocaml
ygrek has joined #ocaml
kolko has quit [Ping timeout: 248 seconds]
mengu has quit [Read error: Connection reset by peer]
peterpp has quit [Ping timeout: 248 seconds]
malina has quit [Quit: Throwing apples of Montserrat]
raphaelss has quit [Ping timeout: 248 seconds]
mengu has joined #ocaml
jlam__ has joined #ocaml
jlam_ has quit [Ping timeout: 248 seconds]
sam has joined #ocaml
sam is now known as Guest71732
peterpp has joined #ocaml
Guest71732 has quit [Ping timeout: 248 seconds]
_whitelogger has joined #ocaml
peterpp has quit [Ping timeout: 248 seconds]
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
coventry has quit [Ping timeout: 240 seconds]
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
AlexRussia has quit [Quit: WeeChat 1.9]
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
sam has joined #ocaml
sam is now known as Guest91996
ygrek_ has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
mfp__ has quit [Ping timeout: 246 seconds]
ygrek has quit [Remote host closed the connection]
Guest91996 has quit [Ping timeout: 240 seconds]
sam__ has joined #ocaml
samrat_ has joined #ocaml
andreas__ has quit [Quit: Connection closed for inactivity]
sam__ has quit [Ping timeout: 240 seconds]
pierpa has quit [Quit: Page closed]
raphaelss has joined #ocaml
jao has quit [Ping timeout: 248 seconds]
mbuf has joined #ocaml
ygrek has joined #ocaml
jlam_ has joined #ocaml
jlam__ has quit [Ping timeout: 240 seconds]
samrat_ has quit [Ping timeout: 240 seconds]
ziyourenxiang has quit [Ping timeout: 240 seconds]
raphaelss has quit [Ping timeout: 240 seconds]
sh0t has quit [Ping timeout: 248 seconds]
alexelcu has quit [Remote host closed the connection]
alexelcu has joined #ocaml
sh0t has joined #ocaml
cbot has joined #ocaml
samrat_ has joined #ocaml
govg has joined #ocaml
nomicflux has joined #ocaml
vramana has quit [Ping timeout: 240 seconds]
mengu has quit [Remote host closed the connection]
raphaelss has joined #ocaml
nomicflux has quit [Quit: nomicflux]
sh0t has quit [Remote host closed the connection]
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
_whitelogger has joined #ocaml
ygrek has quit [Ping timeout: 255 seconds]
bruce_r has quit [Ping timeout: 255 seconds]
bruce_r has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
bruce_r has quit [Ping timeout: 240 seconds]
jimmyrcom_ has quit [Ping timeout: 248 seconds]
coventry has joined #ocaml
<coventry> In this code, why isn't K.t compatible with int32? https://pastebin.com/z8zu8dgJ
johnelse has quit [Ping timeout: 248 seconds]
<coventry> Actually, the question is more, why isn't I.t compatible?
<flux> on line 5, remove ": S"
<flux> the key here is that having that makes the type t abstract
<coventry> flux: Thanks. I vaguely remember something like that from RWO... Any pointers on what to read to clarify that? In RWO or otherwise?
<flux> sorry, I don't have any. actually I haven't coded in OCaml for a while :-o.
<coventry> Ah, found it, "Making the Functor Abstract" in the Functors chapter.
<coventry> Wait, that's not it.
<flux> so basically what's happening is that module M : sig type t end = struct type t = int end makes the type 't' opaque outside the module M
<flux> I mean abstract :-)
<coventry> How is t more abstract without the ": S" constraint? What's abstract mean here, precisely?
<flux> it means the same as you just write 'type t;;' in top level and then try to interact with the type
malina has joined #ocaml
<flux> so you know nothing about the type but its name; you cannot create instances of it and you cannot unify it with other types
<flux> there's also another way to express what you want but in a more precise manner
<flux> instead of removing : S you can have : S with type t = T.t
<flux> but I don't think this brings value in this case
<flux> that's because (as you probably know), ocaml's module system isn't nominal (names being the significant differentiator between modules) but structural
<coventry> Whereas with ": S", what do I know about the type?
<flux> you know what the module type S tells you about it
<flux> and nothing more
<flux> so if the module type S were to provide some operations on t, it could actually be useful
ShalokShalom_ has joined #ocaml
<flux> for example: module type Addable = sig type t val zero : t val add : t -> t -> t val equal : t -> t -> bool end
<coventry> Oh, and then those operations in S could constrain the type? I think I see...
<flux> and now if someone were to implement a module for that int, they could write: module IntAddable : Addable = struct type t = int .. end but you would never be able to tell that it's using 'int' internally
bruce_r has joined #ocaml
<flux> and if they do want to expose the 'int', they can use the 'with'-syntax for rewriting parts of the signature: module IntAddable : Addable with type t = int = struct type t = int .. end
johnelse has joined #ocaml
<flux> ..but for simple scenarios it's the same as just dropping the ': S' altogether, though in that case the module type won't be checked, except perhaps later if it's being used as a functor argument
malina has quit [Quit: Throwing apples of Montserrat]
ShalokShalom has quit [Ping timeout: 240 seconds]
<coventry> Thanks for the explanation. I think I get it now. Also, I think I found the relevant section of the manual: http://caml.inria.fr/pub/docs/manual-ocaml/moduleexamples.html#sec21
ShalokShalom_ is now known as ShalokShalom
<flux> yeah, the official documentation give a nice overview on how things work. next time I'll remember to point to that ;)
<coventry> Your explanation is actually clearer, and uses modern syntax, though.
johnelse has quit [Read error: No route to host]
bruce_r has quit [Ping timeout: 246 seconds]
vramana has joined #ocaml
FreeBirdLjj has joined #ocaml
sgnb has quit [Ping timeout: 248 seconds]
sam has joined #ocaml
sam is now known as Guest14530
johnelse has joined #ocaml
jlam__ has joined #ocaml
jlam_ has quit [Ping timeout: 248 seconds]
enterprisey has joined #ocaml
ziyourenxiang has joined #ocaml
axesd9 has joined #ocaml
axesd9 has quit [Client Quit]
samrat_ has quit [Ping timeout: 248 seconds]
enterprisey has quit [Quit: Leaving]
<flux> lablqml? that's interesting
wickedshell has joined #ocaml
slash^ has joined #ocaml
<adrien> lablqml has been around for a while now
samrat_ has joined #ocaml
peterpp has joined #ocaml
TarVanim_ has joined #ocaml
TarVanim_ has quit [Client Quit]
demonimin has quit [Remote host closed the connection]
demonimin has joined #ocaml
coventry has quit [Ping timeout: 240 seconds]
mfp__ has joined #ocaml
<flux> oops, I just recalled the time lablqml had been part of lablqt, but that indeed must've been eons ago
johnelse has quit [Ping timeout: 240 seconds]
argent_smith has joined #ocaml
samrat_ has quit [Ping timeout: 240 seconds]
johnelse has joined #ocaml
cbot has quit [Quit: Leaving]
johnelse has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
kakadu has quit [Client Quit]
kakadu has joined #ocaml
johnelse has joined #ocaml
argent_smith has quit [Quit: Leaving.]
johnelse has quit [Ping timeout: 240 seconds]
DrWhax_ is now known as DrWhax
Guest14530 has quit [Ping timeout: 248 seconds]
sam has joined #ocaml
sam is now known as Guest37165
johnelse has joined #ocaml
<peterpp> I was going to iterate over a Core.Hashtbl and modify its values at the same time, but Core.Hashtbl.iteri and similar functions in the module all seem to throw an exception
johnelse has quit [Ping timeout: 246 seconds]
johnelse has joined #ocaml
<flux> peterpp, you can use fold or map to collect the list of changes and then apply them afterwards
<peterpp> at the moment I'm iterating over the list of keys and call Core.Hashtbl.change for each
<peterpp> flux, ah, thanks
Guest37165 has quit [Ping timeout: 255 seconds]
sgnb has joined #ocaml
BitPuffin|osx has quit [Remote host closed the connection]
BitPuffin|osx has joined #ocaml
vramana has quit [Quit: vramana]
troydm has joined #ocaml
peterpp has quit [Ping timeout: 248 seconds]
sam has joined #ocaml
sam is now known as Guest85523
jnavila has joined #ocaml
samrat_ has joined #ocaml
samrat_ has quit [Ping timeout: 240 seconds]
magistr has joined #ocaml
kakadu_ has joined #ocaml
kakadu has quit [Ping timeout: 240 seconds]
jnavila has quit [Remote host closed the connection]
kakadu has joined #ocaml
kakadu_ has quit [Ping timeout: 248 seconds]
kakadu_ has joined #ocaml
kakadu has quit [Ping timeout: 248 seconds]
peterpp has joined #ocaml
Guest85523 has quit [Ping timeout: 240 seconds]
vramana has joined #ocaml
samrat_ has joined #ocaml
<kakadu_> I remember a JaneStreet blog post about OCaml speed in general. I was made using light letters on black background. Can you help me to google it?
kakadu_ is now known as Kakadu
<Kakadu> Yeah
<Kakadu> octachron: What did you asked in google?
<octachron> Kakadu, "jane street performance"
<Kakadu> ah
bacam has quit [Quit: upgrade]
<octachron> at the same time, google search is far from being memory-less nowaday
<Kakadu> Yeah, I know
<Kakadu> I asked him about wine comparison and first 5 links were about Wine Is Not Emulator
sam has joined #ocaml
sam is now known as Guest87035
handlex has joined #ocaml
samrat_ has quit [Ping timeout: 246 seconds]
sh0t has joined #ocaml
handlex has quit [Quit: handlex]
handlex has joined #ocaml
trevorriles has quit [Quit: ZNC 1.6.5 - http://znc.in]
Guest87035 has quit [Ping timeout: 240 seconds]
handlex has quit [Client Quit]
govg has quit [Ping timeout: 248 seconds]
govg has joined #ocaml
jlam_ has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 248 seconds]
jlam__ has quit [Ping timeout: 240 seconds]
mbuf has quit [Quit: Leaving]
Last has joined #ocaml
bacam has joined #ocaml
enterprisey has joined #ocaml
axesd9 has joined #ocaml
bacam has quit [Quit: leaving]
bacam has joined #ocaml
bacam has quit [Client Quit]
bacam has joined #ocaml
axesd9 has quit [Client Quit]
sam has joined #ocaml
sam is now known as Guest14956
samrat_ has joined #ocaml
Guest14956 has quit [Ping timeout: 240 seconds]
enterprisey has quit [Remote host closed the connection]
sam has joined #ocaml
sam is now known as Guest62568
<Kakadu> I'm looking at assmbler for function (fun (a,b) -> ignore @@ (a - b))
<Kakadu> And I see something weird. Why?
<Kakadu> .cfi_startproc
<Kakadu> .L124:
<Kakadu> movq▸ $1, %rax
<Kakadu> ret
<Kakadu> .cfi_endproc
argent_smith has joined #ocaml
andreas__ has joined #ocaml
<flux> kakadu, sounds like it's returning unit?
magistr has quit [Remote host closed the connection]
<Kakadu> flux: Something like this. Do you wannna to say that flambda detects that (-) is pure and as a result is ignored it doesn't do subtraction?
<Kakadu> if yes, can I get the same trick for int comparison?
<Kakadu> I tried to put comparison function as argument of `loop` but now it doesn't specialize it for ints
FreeBirdLjj has quit [Remote host closed the connection]
<flux> did you cast it to a integer comparison function?
copy_ has joined #ocaml
BitPuffin|osx has joined #ocaml
FreeBirdLjj has joined #ocaml
sz0 has joined #ocaml
<flux> so it's likely something flambda doesn't know about that it's pure. (polymorphic comparison isn't pure, it can throw)
<copy_> You can opaque_identity to force the computation: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Sys.html#VALopaque_identity
<flux> but it seems the opposite is now desires :)
<Kakadu> So, I did ignore @@ Sys.opaque_identity (-) a b
<Kakadu> And now monomorphic compare is faster
<Kakadu> poly/mono/minus related to 100/30/40
<Kakadu> I got a result that I want. Thanks!
<copy_> `Sys.opaque_identity (-) a b` might be slower than `a - b`, since it's an indirect call
<Kakadu> no, it's fine
<Kakadu> .cfi_startproc
<Kakadu> L124:
<Kakadu> subq▸ %rbx, %rax
<Kakadu> incq▸ %rax
<Kakadu> ret
<Kakadu> .cfi_endproc
nomicflux has joined #ocaml
rwmjones has quit [Ping timeout: 246 seconds]
rwmjones has joined #ocaml
<copy_> Okay
Guest62568 has quit [Ping timeout: 246 seconds]
bruce_r has joined #ocaml
companion_cube has left #ocaml ["WeeChat 1.0.1"]
nomicflux has quit [Quit: nomicflux]
coventry has joined #ocaml
ziyourenxiang has quit [Ping timeout: 255 seconds]
<coventry> Are OCaml objects still used in contemporary software projects? Real-World OCaml has a chapter on them, but I haven't seen them mentioned anyhere else.
<coventry> Everyone seems to be getting by just fine with modules and functors.
bruce_r has quit [Ping timeout: 255 seconds]
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
bruce_r has joined #ocaml
companion_cube has joined #ocaml
nomicflux has joined #ocaml
jlam__ has joined #ocaml
jlam_ has quit [Ping timeout: 255 seconds]
bruce_r has quit [Ping timeout: 246 seconds]
nomicflux has quit [Quit: nomicflux]
sillyotter has joined #ocaml
<coventry> RWO answers my question: "In fact, many seasoned OCaml programmers rarely use classes and objects, if at all."
nomicflux has joined #ocaml
sam has joined #ocaml
sam is now known as Guest86083
sillyotter has quit [Quit: WeeChat 1.4]
Guest86083 has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
nomicflux has quit [Quit: nomicflux]
<coventry> What's an example of OCaml objects' support for row polymorphism? The google results for "row polymorphism" are super abstract.
<Drup> coventry: object themselves are not used often
<Drup> objects types, however, do have some users for typing trickeries
<coventry> Thanks, Drup.
<coventry> This explanation of row polymorphism gets pretty concrete on p. 9. Seems like it's basically duck typing. https://www.cs.cmu.edu/~neelk/rows.pdf
<Drup> it's well-behaved duck typing ;)
<coventry> That must be where the "row" in row polymorphism comes from: All your well-behaved ducks get in a row by themselves.
mengu has joined #ocaml
nomicflux has joined #ocaml
<Drup> exactly
d0nn1e has joined #ocaml
coventry has quit [Ping timeout: 246 seconds]
peterpp has quit [Ping timeout: 248 seconds]
jlam_ has joined #ocaml
jlam__ has quit [Ping timeout: 240 seconds]
cbot has joined #ocaml
enterprisey has joined #ocaml
sam has joined #ocaml
sam is now known as Guest11506
coventry has joined #ocaml
copy_ has quit [Quit: Connection closed for inactivity]
Guest11506 has quit [Ping timeout: 255 seconds]
peterpp has joined #ocaml
bruce_r has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
bruce_r has quit [Ping timeout: 246 seconds]
vramana_ has joined #ocaml
vramana has quit [Ping timeout: 240 seconds]
danieli has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 248 seconds]
sam has joined #ocaml
sam is now known as Guest72449
Guest72449 has quit [Ping timeout: 240 seconds]
nomicflux has quit [Quit: nomicflux]
<coventry> Is there a tool for figuring out which package/filepath a module is defined in? Ideally a merlin command with an emacs binding? "find ~/.opam -name <lowercase-module-name>.mli" works in a pinch, but is slow.
<Drup> coventry: odig has a command that does something like that
<Drup> but it's a bit experimental yet
<coventry> Thanks, will take a look.
samrat_ has quit [Ping timeout: 248 seconds]
enterprisey has quit [Ping timeout: 276 seconds]
<coventry> Which odig command should I use to get the package providing a given module?
<coventry> Oh, I see, you can load a module under it in the toplevel. Thanks again.
<Drup> coventry: apparently, the functionally is present in the library, but not directly accessible in the API
<coventry> Hmm, 'Odig.load "Json_module";;' gives "no object found to load, even though "type b = Json_schema.schema;;" works in the same toplevel.
<Drup> it's used by `odig guess-deps`, though
<coventry> Duh, Json_schema, not Json_module.
<coventry> Great, that works nicely.
salc has joined #ocaml
enterprisey has joined #ocaml
nomicflux has joined #ocaml
sam has joined #ocaml
sam is now known as Guest21780
jmiven has quit [Quit: co'o]
Guest21780 has quit [Ping timeout: 240 seconds]
jmiven has joined #ocaml
ShalokShalom has quit [Remote host closed the connection]
enterprisey has quit [Ping timeout: 240 seconds]
<dogui> is there any semantic difference between `let x : t = e` and `let (x : t) = e` ? I have some code that fails to compile in the second case with "The type of this expression .. contains type variables that cannot be generalized"
<dogui> (trying to minimize it)
<Drup> there shouldn't
<dogui> yikes
<dogui> huh, this doesn't happen on 4.05.0. I was on 4.02.3 before
<dogui> guess I won't bother minimizing this
<dogui> thanks Drup!
<Drup> can you show the not-so-minimal version ?
<coventry> What is the underscore doing in "type _ field = string;;"? Declaring anything of type "'a field" to be of type string?
<Drup> but yeah, 4.02.3 is not-so-recent anymore :p
<Drup> coventry: yes, unnamed type variable
<coventry> Thanks.
<dogui> Drup: it's dozens of files, in code I'm not really familiar with. The offending definition is simply `let (rkeys : (Prims.unit,kset,(Prims.unit,Prims.unit) mon_pkey) m_rref) = m_alloc keyRegion []`
<dogui> (autogenerated code too)
<Drup> yum
enterprisey has joined #ocaml
enterprisey has quit [Read error: Connection reset by peer]
nomicflux has quit [Quit: nomicflux]
<coventry> Where in the manual can I find info about the ':>' operator? RWO only mentions it in the context of classes and objects, but here it seems to be used on a function: "| | Bytes kind -> (kind :> Kind.t)" at https://github.com/tezos/tezos/blob/master/src/minutils/data_encoding.ml#L191 (the declaration for Bytes is "type 'a desc = ... | Bytes : Kind.length -> MBytes.t desc | ...", on line 129 of that file.)
sam has joined #ocaml
sam is now known as Guest92889
<Drup> it's called type coertion
<Drup> coercions*
<coventry> On the other hand, if I type "kind" in "| Bytes kind", I get that it's of Kind.length, which is a type not a function.
<coventry> Thanks, I'll look that up.
<Drup> there isn't much to say about it, except in context with other constructions
<coventry> What's going on in "| Bytes : Kind.length -> MBytes.t desc"? It looks like the type of the argument to Bytes ought to be a "Kind.length -> MBytes.t" function there, but instead it's just a "Kind.length".
Guest92889 has quit [Ping timeout: 240 seconds]
pierpa has joined #ocaml
<Drup> that's a GADT
<Drup> the syntax for constructors is slightly different
<Drup> I warned you that tezos was not a beginner friendly codebase, and you just hit one of those head on :)
nightmared has quit [Ping timeout: 255 seconds]
<coventry> Thank you, that is a huge help. Yes, maybe I'm in over my head, but I'll read about GADT's now. I know them from Haskell at least.
<coventry> Is there a friendlier source than the manual? I don't think they're covered in RWO. Not in the "Language Concepts" part, anyway.
nightmared has joined #ocaml
<coventry> Anyway, the first example covers this syntax.
<Drup> they aren't covered in RWO
<Drup> there are tutorials online
<Drup> but it's a rather complicated subject that is not so easy to teach :p
<coventry> Thanks again. I at least understand what's going in on that code, now.
nightmared has quit [Ping timeout: 255 seconds]
nightmared has joined #ocaml
argent_smith has quit [Quit: Leaving.]
bruce_r has joined #ocaml
Kakadu has quit [Remote host closed the connection]
ziyourenxiang has joined #ocaml
sam__ has joined #ocaml
peterpp has quit [Ping timeout: 248 seconds]
sam__ has quit [Ping timeout: 255 seconds]
ziyourenxiang has quit [Ping timeout: 240 seconds]
enterprisey has joined #ocaml
peterpp has joined #ocaml
jao has joined #ocaml
<coventry> he
<coventry> oops
sam__ has joined #ocaml
enterprisey has quit [Remote host closed the connection]
peterpp has quit [Ping timeout: 248 seconds]
pierpa has quit [Quit: Page closed]