<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) ....
<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 :)
<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>
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?
<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]