adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
hdon has quit [Ping timeout: 248 seconds]
sh0t has quit [Remote host closed the connection]
sh0t has joined #ocaml
govg has quit [Ping timeout: 264 seconds]
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 has quit [Killed (cherryh.freenode.net (Nickname regained by services))]
infinity0 has joined #ocaml
<exarkun> why does the compiler complain "Unbound record field identity" when I can clearly see the field `identity` in the type in the mli?
mfp has quit [Ping timeout: 240 seconds]
<companion_cube> dependencies gone wrong?
<companion_cube> haveyou tried foo.Othermodule.identity?
<exarkun> What's that syntax? `<identifier>.<module name>.<field name>`?
Haudegen has quit [Remote host closed the connection]
<exarkun> ... that seems to work. at least, the compile error moves down the file.
<companion_cube> my guess is OCaml didn't know you depended on the other module
<exarkun> why can't it figure out the fields of the type? :/
<companion_cube> because it doesn't know the type, I guess
<companion_cube> the normal syntax is the qualified one
<companion_cube> i.e. foo.A.a.B.b
<exarkun> it should, I declared it earlier :/
<companion_cube> in the same file?
<companion_cube> be aware that the .ml doesn't use the .mli at all
<exarkun> `let foo config:Othermodule.config = ...`
<exarkun> wat
<companion_cube> ah
<companion_cube> let foo (config:Othermodule.config) = …
<exarkun> oh crap
<companion_cube> otherwise you're saying that foo returns a config
<exarkun> blub
<exarkun> okay good to know I'm still stupider than the compiler, thanks
<companion_cube> it's just a syntax mistake, don't bash yourself
<exarkun> :)
dxtr has joined #ocaml
hdon has joined #ocaml
sh0t has quit [Remote host closed the connection]
pierpal has joined #ocaml
dxtr has quit [Quit: leaving]
hdon has quit [Ping timeout: 240 seconds]
caltelt has joined #ocaml
pierpal has quit [Ping timeout: 260 seconds]
dxtr has joined #ocaml
isd has quit [Quit: Leaving.]
cbot has joined #ocaml
malina has quit [Quit: Throwing apples of Montserrat]
hdon has joined #ocaml
hdon has quit [Ping timeout: 240 seconds]
zlsyx has quit [Quit: Leaving...]
nomicflux has quit [Quit: nomicflux]
hdon has joined #ocaml
pierpal has joined #ocaml
hdon has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 240 seconds]
mbuf has joined #ocaml
tormen_ has joined #ocaml
hdon has joined #ocaml
jbrown has quit [Ping timeout: 260 seconds]
tormen has quit [Ping timeout: 260 seconds]
mbuf has quit [Ping timeout: 256 seconds]
mbuf has joined #ocaml
shinnya has joined #ocaml
pierpa has quit [Quit: Page closed]
mbuf has quit [Read error: Connection reset by peer]
hdon has quit [Ping timeout: 260 seconds]
mbuf has joined #ocaml
govg has joined #ocaml
hdon has joined #ocaml
jimmyrcom_ has quit [Ping timeout: 256 seconds]
mbuf has quit [Ping timeout: 240 seconds]
hdon has quit [Ping timeout: 240 seconds]
mbuf has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
jimmyrcom_ has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
mbuf has left #ocaml ["Leaving"]
hdon has joined #ocaml
pierpal has joined #ocaml
MercurialAlchemi has joined #ocaml
MercurialAlchemi has quit [Client Quit]
pierpal has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
MercurialAlchemi has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
hdon has quit [Ping timeout: 268 seconds]
pluplog has joined #ocaml
pluplog has left #ocaml [#ocaml]
cbot has quit [Quit: Leaving]
al-damiri has quit [Quit: Connection closed for inactivity]
caltelt has quit [Ping timeout: 260 seconds]
jimmyrcom_ has quit [Ping timeout: 248 seconds]
letoh has quit [Ping timeout: 248 seconds]
jimmyrcom_ has joined #ocaml
pluplog has joined #ocaml
pluplog has left #ocaml [#ocaml]
niorrr has joined #ocaml
Chobbes has quit [Ping timeout: 260 seconds]
Chobbes has joined #ocaml
niorrr has quit [Quit: WeeChat 2.0]
niorrr has joined #ocaml
pierpal has joined #ocaml
tarptaeya has joined #ocaml
pierpal has quit [Client Quit]
pierpal has joined #ocaml
<Leonidas> exarkun: you can also write `let foo : Othermodule.config -> _ = fun config -> …`
<Leonidas> exarkun: I seem to be remembering your name from Python's Twisted, correct?
niorrr has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
steenuil has joined #ocaml
kakadu has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Quit: Leaving]
zolk3ri has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 264 seconds]
MercurialAlchemi has joined #ocaml
jimmyrcom_ has quit [Ping timeout: 264 seconds]
silver has joined #ocaml
Haudegen has joined #ocaml
<exarkun> Leonidas: yea, that's me
gareppa has joined #ocaml
jbrown has joined #ocaml
jbrown has quit [Remote host closed the connection]
jbrown has joined #ocaml
hdon has joined #ocaml
hdon has quit [Ping timeout: 240 seconds]
gareppa has quit [Ping timeout: 264 seconds]
BitPuffin has joined #ocaml
gareppa has joined #ocaml
<Khady> any user of topkg and jbuilder? I'm trying to publish a new version of a package. But the version detected by topkg is incorrect
gareppa has quit [Quit: Leaving]
<Khady> --dist-version can be used to fix that with topkg distrib
<Khady> but it doesn't work with topkg opam pkg
<Khady> ok probably I can't tag by hand but need topkg tag
<exarkun> first.mli and second.mli both declare `type 'a foo = Bar : { <some fields> } -> 'a foo`. second.ml defines `type 'a foo = 'a Second.foo = { <some fields> } -> 'a foo`
<exarkun> I guess I understand this to mean that First.foo and Second.foo are equivalent and interchangeable within second.ml
<exarkun> err darn, I screwed that up.
_andre has joined #ocaml
<exarkun> second.ml defines `type 'a foo = 'a First.foo = { <some fields> } -> 'a foo`
<exarkun> Now I have third.ml which has a First.foo and wants to call a function in Second that takes a Second.foo
nomicflux has joined #ocaml
<exarkun> but within third.ml, First.foo and Second.foo seem not to be considered equivalent and interchangeable
<exarkun> What do I do?
tarptaeya has quit [Quit: Konversation terminated!]
sh0t has joined #ocaml
<steenuil> does coercion work?
* exarkun gives that a try
<exarkun> there's no explicit subtyping involved, as far as I can tell, fwiw
<Drup> exarkun: you need to put the equality in the .mli as well
<Drup> `type 'a foo = 'a First.foo = ...` that needs to be in the .mli
<Drup> as far as typechecking in other modules, if there is an .mli, the .ml might as well not exists, it's not visible
<exarkun> The mli file is someone else's code :(
<exarkun> That is, First and Second are third-party and Third is what I am trying to write.
<Drup> then fix their code :)
<Drup> (but the equality might be hidden on purpose)
<Drup> what's the use case ?
<exarkun> in the general case, yes. I am stuck on a particular tag of this project though.
<exarkun> at least for now.
<exarkun> I dunno ... the use case is just that there's a function (in the mli) from this library I want to call yet there seems to be no straightforward way to construct the value it requires as an argument
<Drup> I meant what's the library and what are the types
<exarkun> It seems most likely that this is an oversight because "library" might be an overly generous description of this code
<Drup> x)
<exarkun> meta_config and message_config (mostly message_config) are what I'm having trouble with
Bronsa has quit [Remote host closed the connection]
<exarkun> it wouldn't surprise me if no one has ever called this function from third-party code before
<exarkun> The other "versions" of those types are defined in https://gitlab.com/tezos/tezos/blob/master/src/lib_p2p/p2p.mli
<Drup> the definition is public, can't you just construct it ?
<exarkun> I wrote a naive copy function for meta_config, yes - just construct it from all of the fields of the other version.
<Drup> yeah
<exarkun> I'm stuck on message_config which contains an app_message_encoding list where app_message_encoding is a function type with a similar aliasing problem
<Drup> x)
<Drup> patch it, send the patch upstream
<exarkun> okay, thanks
<steenuil> oh right, there's no subtyping there
<exarkun> Am I reading https://gitlab.com/tezos/tezos/blob/master/src/lib_p2p/p2p.mli#L24-30 correctly? I wonder if I'm not.
<Drup> That's not a re-export of an existing type (nor is it a function), if that's the question
<Drup> it's a GADT with inline record
<exarkun> yea, not a very clear question, sorry. That's what I was reading as a function type but you're saying that's wrong, I think.
<Drup> it is not a function type
<exarkun> so it should be possibly to copy one of those in to one of these - https://gitlab.com/tezos/tezos/blob/master/src/lib_p2p/p2p_pool.mli#L25
<Drup> Yes
<exarkun> thanks again
<Drup> (honestly, I would just do a patch and use Obj.magic in the meantime, but oh well)
* exarkun hears about Obj.magic for the first time
<Drup> ah, forget I said anything then :D
<exarkun> haha. :)
<steenuil> is there a way to test minimum dependency requirements with opam?
<exarkun> All I'm writing is some test code, maybe I won't burn for using Obj.magic here until upstream gives me something better.
<Drup> steenuil: what do you mean by that ?
<steenuil> if I don't annotate the packages I'm using with minimum required version, is there a way to make it try to install the minimum possible version of everything and see if it compiles?
<Drup> ah, yes there are ways to do that
<Drup> steenuil: you'll need to read that https://opam.ocaml.org/doc/2.0/External_solvers.html
<Drup> there is no direct option, but you can ask the solver to give solutions that are "as old as possible"
<steenuil> oh, neat
<Drup> and then you ask opam for a solution (with opam list --resolve) for example
<steenuil> thanks
sh0t has quit [Remote host closed the connection]
letoh has joined #ocaml
aciniglio has joined #ocaml
nomicflux has quit [Quit: nomicflux]
Haudegen has quit [Ping timeout: 264 seconds]
gtrak has joined #ocaml
jrslepak has joined #ocaml
ratsch has quit [Remote host closed the connection]
ratsch has joined #ocaml
Muzer has quit [Ping timeout: 265 seconds]
Haudegen has joined #ocaml
dakk has joined #ocaml
Muzer has joined #ocaml
spew has joined #ocaml
sh0t has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
Haudegen has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
pierpal has quit [Ping timeout: 240 seconds]
spew has quit [Ping timeout: 240 seconds]
mk9 has joined #ocaml
spew has joined #ocaml
aciniglio has quit [Read error: Connection reset by peer]
mk9 has quit [Quit: mk9]
dakk has quit [Read error: Connection reset by peer]
Haudegen has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
dakk has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
al-damiri has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
jimmyrcom_ has joined #ocaml
govg has quit [Ping timeout: 260 seconds]
govg has joined #ocaml
emias has quit [Ping timeout: 264 seconds]
emias has joined #ocaml
govg has quit [Ping timeout: 276 seconds]
<exarkun> utop says: Fatal error: exception Zed_utf8.Out_of_bounds
dakk has quit [Ping timeout: 240 seconds]
spew has quit [Ping timeout: 264 seconds]
spew has joined #ocaml
moolc has joined #ocaml
Fistine has quit [Ping timeout: 255 seconds]
pmetzger has joined #ocaml
Fistine has joined #ocaml
Haudegen has joined #ocaml
spew has quit [Ping timeout: 264 seconds]
exarkun has quit [Ping timeout: 240 seconds]
exarkun has joined #ocaml
srax1 has joined #ocaml
steenuil has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
ygrek has joined #ocaml
silver has quit [Read error: Connection reset by peer]
hdon has joined #ocaml
gareppa has joined #ocaml
hdon has quit [Ping timeout: 264 seconds]
gareppa has quit [Remote host closed the connection]
slash^ has joined #ocaml
spew has joined #ocaml
dakk has joined #ocaml
hdon has joined #ocaml
hdon has quit [Changing host]
hdon has joined #ocaml
<hdon> hi all :) i was asking recently about further restricting the set of values that can be constructed for a given variant type, and was advised to make the variant constructors private, and offer instead a constructor function which allows for a more flexible definition of validity than merely the types of the constructors' argumetns
<hdon> if i go that route, what happens to pattern matching and destructuring for the consumer? can they access a private constructor for these purposes?
Haudegen has quit [Read error: Connection reset by peer]
<copy`> Yes, they can be destructured, see http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec236
dakk has quit [Ping timeout: 256 seconds]
tane has joined #ocaml
Haudegen has joined #ocaml
<pmetzger> This is a neat facility! I keep learning about things in the "extensions" section. Even though I've read it before. :)
<companion_cube> private types are incredibly useful
<pmetzger> I can see why. They will let you enforce arbitrary constraints that the type system can't encode.
<companion_cube> yes, you restrict the trusted base to smart constructors
<companion_cube> and in the other parts of the code, you can rely on more invariants
<pmetzger> I really like OCaml. There are warts, but there's so much good stuff!
<companion_cube> lots of small details are really good
<companion_cube> e.g. the pattern language is really neat
<Drup> the pattern matching is probably the best amongst statically typed/compiled languages
<companion_cube> +1
<Drup> (you can find crazy pattern languages in other paradigms, especially logic or highly dynamic ones, but they tend to have very different trade offs)
<Drup> companion_cube: does datalog count as a pattern language ? :D
<companion_cube> not that I know of :p
<Drup> prolog definitely does
<companion_cube> it's unification, I wouldn't consider them as the same category
<Drup> companion_cube: the end result from a user perspective is similar
<companion_cube> I disagree, but well
<companion_cube> prolog can bind variables in the input, that's a huge difference
<pmetzger> I also really like the community. People will answer questions. You would be surprised how often this is not true.
<pmetzger> People will actually help newcomers with limited experience figure out dumb things.
<exarkun> I moved a type definition from an ml to an mli and broke compilation of the ml on this definition: let equal { conn = { id = id1 } } { conn = { id = id2 } } = id1 = id2
<exarkun> because "Unbound record field conn"
<companion_cube> it's also because the community is small and we're not too flooded with newcomers
<exarkun> the mli also already (and still) includes `val equal: 'msg t -> 'msg t -> bool`
<companion_cube> exarkun: it's not moving, but copying, you know? the ml also needs to have the type def
<exarkun> compilation of the ml doesn't benefit from information in the mli?
<companion_cube> no it doesn't
pierpal has joined #ocaml
<pmetzger> I can name other very small communities that are hostile. People here really are friendly. At least mostly. :)
<pmetzger> There are one or two gruff people but they aren't actually mean either.
<exarkun> That sounds like something someone told me in here a few days ago and I guess I didn't understand (until now, maybe?)
<exarkun> thanks
<companion_cube> exarkun: it might have been me ^^
<exarkun> quite possible :)
<companion_cube> the mli is not used at all when compiling the ml
<pmetzger> Yah, like in a language like Modula-2, you have to have the same type information in the interface file and in the implementation.
<pmetzger> This always seemed quite natural to me, though it does slightly violate the DRY rule. That said, I think it's best this ay.
<pmetzger> er way
<exarkun> But the mli is used somewhere sometime by something
<Drup> pmetzger: did you actually used modula-2 at the time ?
<pmetzger> oh, yah. :)
<exarkun> ... surely?
<companion_cube> it's not very DRY, yes
<pmetzger> I rather liked Modula-2.
<companion_cube> but sometimes you have difference between ml and mli
<Drup> modula-2 is *great*
<companion_cube> private type, opaque type…
<exarkun> indeed
<pmetzger> Drup: It had a few flaws, but it was overall excellent. I never used Oberon though.
<exarkun> the ml and the mli must have to agree at least in some regards though?
<companion_cube> exarkun: they must be compatible
<Drup> as a yougnster, this is one of the few "archologic" languages where there are features that I actually like, from a compsci proglang perspective
<pmetzger> exarkun: anything in the .mli should be compatible with what is in the .ml
<companion_cube> i.e. you must be able to cast the implementation (ml) into the signature (mli)
<exarkun> is compatibility of x.ml and x.mli checked at the time of x.ml complication?
<pmetzger> Drup: I used it when it was almost new. :)
<companion_cube> it's the same process as for modules
<exarkun> _compilation_
<companion_cube> yep
<exarkun> so maybe "not used at all" is ... not the whole truth, at least?
<companion_cube> firsst you compile the interface (into a .cmi) for compiling things that depend on the module
<companion_cube> exarkun: first it's compiled, then compatibility is checked
<pmetzger> Most of Wirth's ideas were quite good, though he was around in an age when academic PL work was more a branch of aesthetics than of mathematics as it is now.
<companion_cube> but the compilation itself totally ignores the .cmi
<Drup> pmetzger: if you look carefully at the OCaml module system, it's as much a descendent of ML than it is of Modula-2
<Drup> modula-2 had functor-ish, mli-ish, fancy separate compilation
<companion_cube> did it compile fast?
<Drup> yes
<companion_cube> so Go really doesn't have any excuse :]
<Drup> (everything compiled fast back then)
<pmetzger> Most modula-2 compilers were very good.
<pmetzger> There wasn't enough RAM to compile slow, really. :)
<Drup> exactly :D
<pmetzger> If your machine had no more than a couple hundred K of memory you couldn't be stupid about compiler organization.
<pmetzger> No giant stone castles of unneeded complexity.
<companion_cube> :D
<Drup> pmetzger: in all cases, it's pretty clear that Xavier Leroy was also rather fond of Modula-2
<pmetzger> Indeed.
pierpal has quit [Ping timeout: 268 seconds]
pierpal has joined #ocaml
pmetzger has quit []
pierpal has joined #ocaml
sz0 has joined #ocaml
jack5638 has quit [Ping timeout: 248 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
jack5638 has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
pierpal has quit [Ping timeout: 268 seconds]
slash^ has quit [Read error: Connection reset by peer]
moolc has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
pierpa has joined #ocaml
dedgrant_ has quit [Ping timeout: 260 seconds]
argent_smith has quit [Quit: Leaving.]
Haudegen has joined #ocaml
jnavila has joined #ocaml
muelleme has joined #ocaml
steenuil has joined #ocaml
dedgrant_ has joined #ocaml
pierpal has joined #ocaml
mcspud has quit [Ping timeout: 276 seconds]
_whitelogger has joined #ocaml
mcspud has joined #ocaml
pierpal has quit [Ping timeout: 260 seconds]
niorrr has joined #ocaml
muelleme has quit [Ping timeout: 248 seconds]
_andre has quit [Quit: leaving]
Fardale has quit [Ping timeout: 264 seconds]
tobiasBora has quit [Ping timeout: 268 seconds]
Fistine has quit [Ping timeout: 256 seconds]
Fardale has joined #ocaml
jnavila has quit [Remote host closed the connection]
nullifidian has quit [Remote host closed the connection]
Fardale has quit [Ping timeout: 264 seconds]
niorrr has quit [Quit: WeeChat 2.0]
spew has quit [Ping timeout: 248 seconds]
gtrak has quit [Ping timeout: 256 seconds]
Fardale has joined #ocaml
tobiasBora has joined #ocaml
orbifx has joined #ocaml
<orbifx> sup folk?
niorrr has joined #ocaml
cbot has joined #ocaml
niorrr has quit [Quit: WeeChat 2.0]
spew has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
spew has quit [Ping timeout: 240 seconds]
nullifidian has joined #ocaml
aubian has joined #ocaml
kakadu has quit [Remote host closed the connection]
orbifx has quit [Quit: WeeChat 2.1]
cbot has quit [Ping timeout: 256 seconds]
niorrr has joined #ocaml
cbot has joined #ocaml
tane has quit [Remote host closed the connection]
niorrr has quit [Quit: WeeChat 2.0]
gtrak has joined #ocaml
kuwze has joined #ocaml
<kuwze> hey I am trying to install something called cduce and I am having trouble getting past this build error: "curl: autodetecting... ocamlfind: Package `curl' not found"
<kuwze> I tried installing https://opam.ocaml.org/packages/conf-libcurl/ but that didn't solve it
<kuwze> oh I am a complete idiot... installing ocurl solved it for me
<kuwze> sorry for bothering you guys
nicoo has quit [Ping timeout: 255 seconds]
gtrak has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
cbot has quit [Ping timeout: 260 seconds]
spew has joined #ocaml
cbot has joined #ocaml
spew has quit [Ping timeout: 248 seconds]
cbot has quit [Read error: Connection reset by peer]
cbot has joined #ocaml