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
cobreadmonster has joined #ocaml
mnemem has joined #ocaml
silver has quit [Read error: Connection reset by peer]
discord5 has quit [Read error: Connection reset by peer]
discord6 has joined #ocaml
mnemem has quit [Ping timeout: 256 seconds]
on_ion has joined #ocaml
mfp has quit [Ping timeout: 276 seconds]
discord6 has quit [Remote host closed the connection]
discord1 has joined #ocaml
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 256 seconds]
shinnya has quit [Ping timeout: 265 seconds]
hdon has quit [Ping timeout: 260 seconds]
jao has quit [Ping timeout: 256 seconds]
steenuil has quit [Ping timeout: 260 seconds]
spew has joined #ocaml
hdon has joined #ocaml
hdon has quit [Ping timeout: 248 seconds]
spew has quit [Quit: Leaving]
zmt00 has quit [Quit: Leaving]
Autolycus has joined #ocaml
zmt00 has joined #ocaml
sh0t has quit [Remote host closed the connection]
pierpa has quit [Quit: Page closed]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
mbuf has joined #ocaml
JimmyRcom_ has quit [Ping timeout: 240 seconds]
<xvilka_> hi
<xvilka_> what does it want from me? https://pastebin.com/W9WatCRy
<xvilka_> why it doesn't like the types I used?
<jpx> xvilka_: it wants you to learn how to think for yourself
<jpx> val init: unit -> Zmq.Context.t * ([> `Pub] Zmq.Socket.t) * ([> `Pub] Zmq_lwt.Socket.t) * ([> `Sub] Zmq.Socket.t) * ([> `Sub] Zmq_lwt.Socket.t) <- eyesore
<xvilka_> jpx: well, I never used such strange types before, so I have no idea whats wrong with them
<xvilka_> jpx: google isn't very helpful in this case
<jpx> didn't you consult the documentation
<jpx> s/didn't/did
<xvilka_> jpx: what documentation?
<xvilka_> jpx: basically I had many workers with that code copy-pasted for connecting to the ZMQ. I just now want to move it into the library, and I have to make initialization in the library and return pub/sub/context.
MercurialAlchemi has joined #ocaml
<xvilka_> jpx: so, you didn't said what part of documentation describes those
hdon has joined #ocaml
<xvilka_> I mean when you says RTFM, at least point to the right manual
<xvilka_> *say
* jpx is away (20 mins)
hdon has quit [Ping timeout: 248 seconds]
isd has joined #ocaml
<xvilka_> nevermind, solved
<xvilka_> it was required this
<xvilka_> val init: unit -> Zmq.Context.t * ([`Pub] Zmq.Socket.t) ....
<xvilka_> not sure why OCaml add '>' sign.
<xvilka_> *added
mcspud has quit [Ping timeout: 260 seconds]
mcspud has joined #ocaml
gtrak has quit [Ping timeout: 264 seconds]
gtrak has joined #ocaml
<Enjolras> baiscally (at least from practical standpoint, don't know the theory) [> `Foo ] is not a type, it's more like a type constraint
<Enjolras> think 'a such that 'a is a supertype of [ `Foo ]
<Enjolras> so something shady happens when you try to return it, but i don't know how it works exactly
Autolycus has quit [Quit: Connection closed for inactivity]
cbot has quit [Quit: Leaving]
mnemem has joined #ocaml
mnemem has quit [Ping timeout: 264 seconds]
<xvilka_> Enjolras: thx!
<Enjolras> xvilka_: sorry i can't give you the exact explaination of what's happening it's a bit blurry in my head :)
dariusf has joined #ocaml
dariusf has quit [Client Quit]
dariusf has joined #ocaml
isd has quit [Quit: Leaving.]
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
cobreadmonster has quit [Quit: Connection closed for inactivity]
steenuil has joined #ocaml
Haudegen has joined #ocaml
bartholin has quit [Quit: Leaving]
freusque has joined #ocaml
tarptaeya has joined #ocaml
malina has joined #ocaml
jaar has joined #ocaml
jaar has quit [Remote host closed the connection]
jaar has joined #ocaml
jaar has quit [Remote host closed the connection]
jaar has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
<apache2> xvilka_: I can't see your example paste because it blocks me, but you can think of [> ] at "at least" this, maybe more
<apache2> it's the opposite of [< `A | `B] which is kind of like "one of these two"
<apache2> you can make [> `Pub] -> [`Pub] by restricting it
<apache2> either through type inference (like with a mach case) or by explicitly typing your function argument
<Enjolras> apache2: basically the example is val : unit -> [> `A ] in mli and then the implementation returning `A not matching the signature
<Enjolras> which makes sense because the variable is instanciate in the implementation type but i don't know how to explain properly
<apache2> let init () (zmq_context * (pub_socket:[`Pub] Zmq.Socket.t as 'pubsocket) * (zmq_lwt_socket : [`Pub] Zmq_lwt.Socket.t) * (sub_socket:[`Sub] Zmq.Socket.T))
<apache2> Enjolras: ah, sorry, that's the other way around then
<apache2> utop # let init () : [> `A] = `A;;
<apache2> val init : unit -> [> `A ] = <fun>
<apache2> you can usually also coerce it with the :> operator
<apache2> let x = `A in (x :> [> `A])
<apache2> if (x : [> `A]) doesn't work
mnemem has joined #ocaml
noitakomentaja has joined #ocaml
hdon has joined #ocaml
Bronsa has joined #ocaml
hdon has quit [Ping timeout: 264 seconds]
noitakomentaja has quit [Ping timeout: 250 seconds]
zolk3ri has joined #ocaml
noitakomentaja has joined #ocaml
mfp has joined #ocaml
noitakomentaja has quit [Ping timeout: 250 seconds]
jao has joined #ocaml
mnemem has quit [Ping timeout: 264 seconds]
Haudegen has quit [Remote host closed the connection]
ziyourenxiang has joined #ocaml
dariusf has quit [Quit: Lost terminal]
noitakomentaja has joined #ocaml
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
wklm has joined #ocaml
shw has quit [Quit: shw]
dhil has joined #ocaml
mathsm has quit [Ping timeout: 268 seconds]
Madars has quit [Ping timeout: 260 seconds]
Haudegen has joined #ocaml
kakadu has joined #ocaml
mathsm has joined #ocaml
Madars has joined #ocaml
hdon has joined #ocaml
Bronsa has quit [Remote host closed the connection]
hdon has quit [Ping timeout: 256 seconds]
shinnya has joined #ocaml
neatonk has joined #ocaml
neatonk has quit [Client Quit]
neatonk has joined #ocaml
neatonk1 has joined #ocaml
jao has quit [Remote host closed the connection]
neatonk has quit [Ping timeout: 240 seconds]
neatonk1 is now known as neatonk
dhil has quit [Ping timeout: 260 seconds]
spew has joined #ocaml
neatonk1 has joined #ocaml
neatonk1 has quit [Client Quit]
jao has joined #ocaml
neatonk has quit [Ping timeout: 248 seconds]
gtrak has quit [Ping timeout: 260 seconds]
dhil has joined #ocaml
_andre has joined #ocaml
spew has quit [Quit: Leaving]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
tarptaeya has quit [Quit: Konversation terminated!]
tarptaeya has joined #ocaml
dhil has quit [Ping timeout: 256 seconds]
sh0t has joined #ocaml
dhil has joined #ocaml
mbuf has quit [Quit: Leaving]
wklm has quit [Ping timeout: 255 seconds]
FreeBirdLjj has joined #ocaml
spew has joined #ocaml
noitakomentaja has quit [Ping timeout: 250 seconds]
mk9 has joined #ocaml
noitakomentaja has joined #ocaml
argent_smith has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
_andre has quit [Read error: No route to host]
aciniglio has joined #ocaml
_andre has joined #ocaml
mk9 has quit [Remote host closed the connection]
jaar_ has joined #ocaml
jaar has quit [Read error: Connection reset by peer]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
argent_smith1 has joined #ocaml
dhil_ has joined #ocaml
argent_smith has quit [Ping timeout: 260 seconds]
mk9 has joined #ocaml
dhil has quit [Ping timeout: 265 seconds]
sh0t has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
gtrak has joined #ocaml
hdon has joined #ocaml
hdon has quit [Ping timeout: 260 seconds]
emarais has joined #ocaml
emarais has left #ocaml [#ocaml]
gtrak has quit [Ping timeout: 264 seconds]
gtrak has joined #ocaml
rambocoder has joined #ocaml
emarais has joined #ocaml
emarais has left #ocaml [#ocaml]
jao has quit [Ping timeout: 256 seconds]
noitakomentaja has quit [Ping timeout: 250 seconds]
noitakomentaja has joined #ocaml
dhil_ has quit [Ping timeout: 256 seconds]
elusyo has joined #ocaml
dhil_ has joined #ocaml
elusyo has quit [Client Quit]
noitakomentaja has quit [Ping timeout: 250 seconds]
shinnya has quit [Quit: ZNC - http://znc.in]
shinnya has joined #ocaml
sh0t has joined #ocaml
neatonk has joined #ocaml
silver has joined #ocaml
hdon has joined #ocaml
malina has quit [Ping timeout: 240 seconds]
hdon has quit [Ping timeout: 264 seconds]
mk9 has quit [Quit: mk9]
malina has joined #ocaml
shinnya has quit [Ping timeout: 265 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
FreeBirdLjj has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Haudegen has quit [Remote host closed the connection]
freusque has quit [Quit: WeeChat 2.0]
Bronsa has joined #ocaml
mnemem has joined #ocaml
zv has quit [Ping timeout: 260 seconds]
bartholin has joined #ocaml
jao has joined #ocaml
jaar_ has quit [Quit: Leaving]
zv has joined #ocaml
madroach has quit [Quit: leaving]
pmetzger has joined #ocaml
pmetzger has quit [Client Quit]
Haudegen has joined #ocaml
rambocoder has quit [Quit: Connection closed for inactivity]
dhil_ has quit [Ping timeout: 240 seconds]
neatonk has quit [Ping timeout: 256 seconds]
wklm has joined #ocaml
wklm has quit [Client Quit]
Bronsa has quit [Ping timeout: 260 seconds]
dhil_ has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
ziyourenxiang has quit [Ping timeout: 240 seconds]
hdon has joined #ocaml
FreeBirdLjj has joined #ocaml
sz0 has joined #ocaml
dhil_ has quit [Ping timeout: 260 seconds]
hdon has quit [Changing host]
hdon has joined #ocaml
mnemem has quit [Ping timeout: 260 seconds]
kakadu has quit [Quit: Konversation terminated!]
neatonk has joined #ocaml
malina has quit [Ping timeout: 240 seconds]
btbytes has joined #ocaml
tane has joined #ocaml
<Leonidas> I have this fun code (simplified): https://gist.github.com/Leonidas-from-XIV/6d22e9cd6efb21e6995245447d60d80d and I am wondering how I can make it type.
<Leonidas> the compiler is very much hung up on the name of the types
<Leonidas> I can get it to compile if I spell out the variants
<Leonidas> but maybe there is a nicer way?
ygrek has joined #ocaml
isd has joined #ocaml
ZirconiumX has joined #ocaml
<ZirconiumX> I'd like to add support for recognising ID_LIKE in depext, because my distro (Arch Linux ARM) isn't recognised. I noticed that raspbian is special-cased, but it also uses ID_LIKE=debian, so I think it would be cleaner to detect that instead.
<ZirconiumX> *for recognising ID_LIKE in /etc/os-release in depext
<ZirconiumX> How best should I go about this?
<ZirconiumX> Perhaps I'll just file an issue.
<octachron> Leonidas, an explicit coercion (x:>baz) should make the compiler happy
tarptaeya has quit [Quit: Konversation terminated!]
malina has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<Leonidas> octachron: thanks, that worked
FreeBirdLjj has quit [Ping timeout: 245 seconds]
kakadu has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
mnemem has joined #ocaml
mnemem has quit [Ping timeout: 240 seconds]
barcabuona has joined #ocaml
mk9 has joined #ocaml
mk9 has quit [Client Quit]
mk9 has joined #ocaml
mk9 has quit [Client Quit]
mk9 has joined #ocaml
Haudegen has quit [Remote host closed the connection]
Bronsa has joined #ocaml
dhil_ has joined #ocaml
cobreadmonster has joined #ocaml
<hdon> hi all :) someone (here i think) told me that open recursion as the default (for example, achieved with forward declarations in C) was problematic and why it wasn't the behavior in ocaml. can anyone explain this to me or link me to an explanation? (or maybe tell me i probably misunderstood this person:)
dhil_ has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
<apache2> hdon: I think it's mostly that it makes life harder for the compiler
orbifx has joined #ocaml
<orbifx> what'up camlers?
aciniglio has quit [Ping timeout: 240 seconds]
<hdon> apache2: mmm... yes but i was hoping for more insight into why this is :)
<apache2> this sounds plausible https://stackoverflow.com/a/1891573
tane has quit [Quit: Leaving]
<octachron> hdon, I was telling you that with type inference + parametric polymorphism (+ side-effect) the decision of making all definition mutually recursive lives in a completely different design space in OCaml compared to C
<octachron> and since C needs forward definitions, it is not really like definitions are mutually recursive by default in C
<mrvn> making everything recursive will break 'let foo x y = x + y let foo y = foo 6 + y' style constructs.
<octachron> Making recursion explicit helps to simplify the potential inferred types and in return, it helps to communicate more understandable type errors to users
<octachron> mrvn, more precisely, explicit polymorphic annotations would be needed in lot of place
<apache2> octachron: speaking of polymorphic annotations, how do I specify a function type that takes an arbitrary about of arguments as arguments, is that possible?
<mrvn> no
<apache2> like ('a -> 'b) where I don't care if 'a is really 'x or 'x -> 'y
<mrvn> apache2: That you can do. 'a will do.
<apache2> and I want to apply one argument to the function and return the resulting applied curried function
<mrvn> apache2: the argument would have to be of type "'x -> 'y"
<mrvn> you can't magically curry that
<apache2> ok
<mrvn> You can have 'a -> 'b where 'b is 'x or 'x -> 'y. But that has to somehow depend on the 'a.
<octachron> apache2, do you mean "let app x f = f x" ?
<apache2> octachron: yes
<apache2> ah, the signature of that function makes sense, thanks!
<octachron> with currying, one can say that functions only take one argument
<mrvn> apache2: that's isn't arbitrary number of arguments though. "f" just takes one argument and then returns something polymorphic.
<apache2> mrvn: but then 'b in this case would have the remainder, right?
<apache2> from val app : 'a -> ('a -> 'b) -> 'b
<mrvn> That's the nice thing about currying. Functions always only ever take one argument. The result can just be another function again.
<apache2> makes sense, thanks!
<mrvn> apache2: yep. 'b is the remainder and can be arbitrary.
isd has quit [Quit: Leaving.]
btbytes has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<discord1> <Perry> This actually reminds me, is there any theory of variadic functions that can work in an ML type language? My guess is that if there is, it isn't obvious. So things like Printf have to be done with compiler hacks?
<thizanne> for those who know Format, is this a normal behaviour ? http://paste.awesom.eu/thizanne/TMfN
<spew> Perry: dependent types handle it prettily
mk9 has quit [Quit: mk9]
<apache2> Perry printf is implemented using GADT?
mk9 has joined #ocaml
<thizanne> yes, Printf is no longer a compiler hack
<thizanne> (except for the shared syntax with strings, but that's merely a syntax issue)
<thizanne> Drup: sorry to bother, but you might have an insight on my previous question 5 lines above (please don't spend more than a few seconds on it)
<discord1> <Perry> Is there an explanation of how it works somewhere?
neatonk has quit [Ping timeout: 264 seconds]
cbot has joined #ocaml
<thizanne> Perry: http://gallium.inria.fr/~remy/mpri/exams/final-2013-2014.pdf, part 1, explains it step by step (but it's an exam so you actually have to do the steps by yourself, which is probably what you want anyway)
<octachron> thizanne, what is the problem?
<thizanne> bar is printed before the second `-`
<thizanne> adding %! or @? after the %a doesnt change the result
<thizanne> oh wait
<thizanne> I'm an idiot.
<octachron> the second "-" is part of "- : unit"
<thizanne> please forget about it :)
<thizanne> it was a bit confusing though
<octachron> Perry, without GADTs, "variadic" functions are also doable with continuations
<Drup> this explains more or less how the variadic part of format works
<discord1> <mars0i> @apache2: > octachron: speaking of polymorphic annotations, how do I specify a function type that takes an arbitrary about of arguments as arguments, is that possible?
<Drup> (btw, printf was never a compiler hack, the *syntax* was, not the variadic part)
<Drup> (and the syntax still is)
<discord1> <mars0i> You got the deep answers. Here's the shallow answer: Define the function and then see what type utop or merlin says it is.
silver has quit [Ping timeout: 248 seconds]
jao has quit [Disconnected by services]
jao has joined #ocaml
cobreadmonster has quit [Quit: Connection closed for inactivity]
<discord1> <Perry> So I mentioned this on the discord side, but I'll say it here again: I think I have a fun or disgusting (depending on your viewpoint) hack for validating that OCaml sources are valid utf-8 without needing to do more than change a few lines of the ocamllex specification.
<discord1> <Perry> It appears you can recognize utf-8 with a regular grammar.
bobby_ has joined #ocaml
<discord1> <Perry> If latin-1 codepoints are disallowed in identifiers, then there are only a couple of places where an eighth bit set char would be permitted at all, and it is possible to recognize a valid utf8 sequence in those places. 😃
<discord1> <Perry> I don't know if this is cool or horrible 😃
bobby_ has quit [Client Quit]
<discord1> <Perry> Now this wouldn't be quite right as it wouldn't detect illegal sequences like utf-8 encodings of surrogates, but it would be okayish.
gtrak has quit [Ping timeout: 260 seconds]
<octachron> utf-8 encoded surrogates are also regular, are they not?
<discord1> <Perry> Yah, but the regexps start getting gross. I guess I can do it, though, if people insist. 😃
<discord1> <Perry> It isn't too bad.
<discord1> <Perry> The error messages will be a bit weird for users, but it will be doable.
isd has joined #ocaml
sh0t has quit [Remote host closed the connection]
Haudegen has quit [Remote host closed the connection]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
pierpa has joined #ocaml
<hdon> octachron: can your recommend any reading on this subject?
malina has quit [Ping timeout: 256 seconds]
<hdon> i'm very surprised that side-effects have anything to do with it
mk9 has quit [Quit: mk9]
<hdon> thanks apache2 this is interesting
<hdon> what is meant by "implicitly-recursive fun-bound functions and non-recursive val-bound functions" (from apache2's link)
orbifx has quit [Quit: WeeChat 2.1]
<octachron> hdon, the existence of mutable values has a lot of consequences on the typing itself, e.g. "let rec x = None and y = ref x" yield different types than "let x = None let y = ref x"
<octachron> hdon, a recursive value would be something like "let rec x = 1 :: x"
<octachron> Perry, I think it is a situation where being exactly right matters
<hdon> you are blowing my mind octachron
argent_smith1 has quit [Quit: Leaving.]
shinnya has joined #ocaml
<octachron> hdon, I don't know which books I should recommand in term of language design. You could maybe start with OCaml reference manual to get a better idea on the potential complexity of the type system.
cbot has quit [Ping timeout: 268 seconds]
kakadu has quit [Remote host closed the connection]
jao has quit [Disconnected by services]
jao has joined #ocaml
Bronsa has quit [Ping timeout: 245 seconds]
<apache2> I'm still looking for a good explanation of the type constraint system
jao has quit [Disconnected by services]
jao has joined #ocaml
<apache2> recently the & sign started showing up more and more in articles I read
sz0 has quit [Quit: Connection closed for inactivity]
greenbagels_ is now known as greenbagels