<Drup>
when I saw the feature request, I though "wait, I remember the same feature request from a long time ago ..." =')
darkf has joined #ocaml
<AltGr>
Indeed :)
<Drup>
It feels like much older than one year ago, though
<AltGr>
800 issues ago... :)
<Drup>
waow :O
shinnya has quit [Ping timeout: 252 seconds]
mearnsh has quit [Ping timeout: 272 seconds]
mearnsh has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
govg has quit [Ping timeout: 256 seconds]
seanmcl has joined #ocaml
seanmcl has quit [Max SendQ exceeded]
seanmcl has joined #ocaml
c74d is now known as Guest28244
Guest28244 has quit [Read error: Connection reset by peer]
c74d has joined #ocaml
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
javamonn has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
ghostpl_ has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
javamonn has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest36251
MrScout has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
javamonn has quit [Remote host closed the connection]
javamonn has joined #ocaml
s1n4 has quit [Ping timeout: 264 seconds]
Guest36251 has quit [Remote host closed the connection]
javamonn has quit [Remote host closed the connection]
josch_ has joined #ocaml
<josch_>
since there doesn't seem to be a library offering this, I want to write an ocaml function that parses a quoted shell command line string into an argument vector that can be passed to execv
<josch_>
i'm familiar with ocaml but come from an imparative background so i have trouble finding the right approach to writing such a parsing function
<josch_>
naively I would do String.explode on the input string and then go over the characters in a tail recursive function as a state-machine
<josch_>
are there more elegant approaches?
javamonn_ has joined #ocaml
n-pyon-complete is now known as realizable-pyon
kdef has quit [Quit: Leaving]
hefner has quit [Ping timeout: 245 seconds]
javamonn_ has quit []
MercurialAlchemi has joined #ocaml
hefner has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 255 seconds]
<adrien>
josch_: you mean each argument is already separated?
siddharthv_away is now known as siddharthv
s1n4 has joined #ocaml
nojb has joined #ocaml
<def`>
josch_: this seems local and have a simple interface… you can still expose a pure function and have an imperative implementation. Do what is the most familiar to you
ygrek has joined #ocaml
govg has joined #ocaml
<josch_>
adrien: i mean turning a string like
<josch_>
echo "foo" "bar\"blub""baz" "'" "\"" foo\ bar "\\" '\''
<josch_>
so respecting double/single quotes and escapes as the shell does it
cesar_ has joined #ocaml
cesar_ is now known as Guest87393
<josch_>
i just wanted to confirm that a function like this doesn't already exist and whether a String.explode based approach is not a totally stupid one :)
mcclurmc has joined #ocaml
<adrien>
I'd rather use one of the parsing tools
<adrien>
string split is going to be quite annoying
Guest87393 has quit [Ping timeout: 256 seconds]
<josch_>
adrien: what do you exactly mean when you say "parsing tools"? like, Lexing?
<adrien>
ocamllex or menhir
<josch_>
okay, thanks :)
<josch_>
i'll look into that first, then
<dmbaturin>
You should look into both.
<dmbaturin>
For this task a lexer alone can be enough, but menhir can make it easier I guess.
<josch_>
awesome! thanks for your comments! I could've done it using the techniques i know but this way I learn something new :)
<adrien>
parsing shell stuff can be tricky: many escapes
<josch_>
yeah :(
<josch_>
lucky that there is only one nesting level
dsheets has joined #ocaml
<def`>
yep, a lexer alone is probably better, you don't have a structured language here
Submarine has quit [Quit: Leaving]
thomasga has joined #ocaml
ggole has joined #ocaml
jbrown has quit [Quit: Client exiting]
Gama11 has joined #ocaml
dav_ has joined #ocaml
dav has quit [Ping timeout: 264 seconds]
avsm has joined #ocaml
mengu has joined #ocaml
govg has quit [Remote host closed the connection]
Simn has joined #ocaml
dav_ has quit [Ping timeout: 255 seconds]
dav has joined #ocaml
Gama11 has quit [Ping timeout: 255 seconds]
Gama11 has joined #ocaml
matason has joined #ocaml
tane has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest97298
Haudegen has quit [Ping timeout: 250 seconds]
Guest97298 has quit [Ping timeout: 265 seconds]
dav has quit [Ping timeout: 255 seconds]
dav_ has joined #ocaml
jonludlam has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
milosn has quit [Ping timeout: 250 seconds]
mort___ has joined #ocaml
Haudegen has joined #ocaml
contempt has quit [Ping timeout: 272 seconds]
testcocoon has joined #ocaml
larhat has joined #ocaml
contempt has joined #ocaml
mengu has quit [Ping timeout: 248 seconds]
siddharthv is now known as siddharthv_away
siddharthv_away is now known as siddharthv
contempt has quit [Ping timeout: 272 seconds]
pii4 has quit [Ping timeout: 250 seconds]
pii4 has joined #ocaml
<haesbaert>
barf, I need a hand with formatting functions :/ (again)
<haesbaert>
more especifically this: let notice_lwt fmt = Lwt.return (notice fmt)
<haesbaert>
I want it to call the formatting function, but return Lwt_unit
<dsheets>
grrr github hates user input normalization and their API consumers
<dsheets>
;-(
larhat has quit [Quit: Leaving.]
oscar_toro has quit [Ping timeout: 256 seconds]
<MercurialAlchemi>
haesbaert: what's Lwt_unit? unit Lwt.t?
<nojb>
haesbaert: let klog k level fmt = if level then Printf.kfprintf k stderr (fmt ^^ "\n%!") else Printf.ikfprintf k stderr fmt and let notice_lwt fmt = klog (fun _ -> Lwt.return_unit) Notice fmt
<haesbaert>
OHHHH now I finally understood how this continuation works
<haesbaert>
MercurialAlchemi: yes
<haesbaert>
nojb: thanks a lot, really :D
<nojb>
np
j0sh has joined #ocaml
<haesbaert>
btw, what does the "k" prefix stands for ?
<haesbaert>
I've noticed it is in all continuations
<haesbaert>
"K"ontinuation?
<nojb>
yep
<haesbaert>
ack
kakadu has joined #ocaml
xificurC has joined #ocaml
ghostpl_ has joined #ocaml
milosn has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
<Leonidas>
exactly
milosn has joined #ocaml
realizable-pyon has quit [Quit: My morality has evaporated under the harsh UV light.]
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
pyon has joined #ocaml
siddharthv is now known as siddharthv_away
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
ygrek has quit [Remote host closed the connection]
larhat has joined #ocaml
mengu has joined #ocaml
tane has quit [Quit: Verlassend]
cesar_ has joined #ocaml
cesar_ is now known as Guest67602
Guest67602 has quit [Ping timeout: 256 seconds]
jonludlam has quit [Ping timeout: 264 seconds]
sdothum has joined #ocaml
jonludlam has joined #ocaml
psy_ has quit [Ping timeout: 265 seconds]
milosn has quit [Ping timeout: 264 seconds]
mengu has quit [Remote host closed the connection]
kakadu has quit [Ping timeout: 246 seconds]
_andre has joined #ocaml
tane has joined #ocaml
psy_ has joined #ocaml
nojb has quit [Quit: nojb]
mengu has joined #ocaml
milosn has joined #ocaml
matason has quit [Ping timeout: 272 seconds]
slash^ has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
matason has joined #ocaml
avsm has quit [Quit: Leaving.]
milosn has quit [Read error: Connection reset by peer]
martintrojer has quit [Max SendQ exceeded]
milosn has joined #ocaml
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
dav has joined #ocaml
martintrojer has joined #ocaml
mcclurmc has quit [Ping timeout: 255 seconds]
dav_ has quit [Ping timeout: 255 seconds]
dav_ has joined #ocaml
dav has quit [Ping timeout: 250 seconds]
acieroid has quit [Ping timeout: 244 seconds]
acieroid has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest75451
milosn has quit [Ping timeout: 246 seconds]
matason has quit [Ping timeout: 265 seconds]
Guest75451 has quit [Ping timeout: 265 seconds]
dav_ has quit [Ping timeout: 256 seconds]
djellemah_ has joined #ocaml
dav has joined #ocaml
djellemah has quit [Ping timeout: 246 seconds]
matason has joined #ocaml
AlexRussia has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
milosn has joined #ocaml
olibjerd has joined #ocaml
AlexRussia has quit [Ping timeout: 265 seconds]
idegen has joined #ocaml
milosn has quit [Ping timeout: 245 seconds]
agarie has joined #ocaml
badkins has joined #ocaml
AltGr has left #ocaml [#ocaml]
milosn has joined #ocaml
<tane>
does anyone know a http client library that supports keep alive?
<Drup>
cohttp doesn't ?
<tane>
i tried cohttp but strace shows multiple calls to socket()
<tane>
if it supports it, i don't know how
<MercurialAlchemi>
AFAIK, there are only two http libs for ocaml, cohttp and ocamlnet
<MercurialAlchemi>
which async lib do you use with it?
<tane>
lwt
<MercurialAlchemi>
hmm
<MercurialAlchemi>
with an 1.1 client?
<MercurialAlchemi>
er, server, in your case
<tane>
i want to perform requests, so i'm using the client
<tane>
1.1, yes
<MercurialAlchemi>
well, it should work
<MercurialAlchemi>
don't let reality get in the way of theory
<tane>
my problem is, that i cannot see the way keep-alive is set on the API
<tane>
i can give headers connection: keep-alive, but sending a header and actually following what it means are two different things
<tane>
and strace tells me different, or i read it wrong
<tane>
i'll try with ocamlnet and compare then
mcclurmc has joined #ocaml
<MercurialAlchemi>
tane: my understanding is that 1.1 connections are keep-alive per default
mengu has quit [Remote host closed the connection]
<tane>
ok
<tane>
thanks then
<tane>
i'll try again :)
<MercurialAlchemi>
control that it's not an issue with the server by testing with curl
<tane>
alright
idegen has left #ocaml [#ocaml]
AlexRussia has joined #ocaml
milosn has quit [Ping timeout: 248 seconds]
avsm has joined #ocaml
agarie has quit [Remote host closed the connection]
milosn has joined #ocaml
|jbrown| has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest22995
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
Guest22995 has quit [Ping timeout: 265 seconds]
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
uris77 has joined #ocaml
|jbrown| has quit [Ping timeout: 256 seconds]
tizoc has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
|jbrown| has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
|jbrown| has quit [Remote host closed the connection]
BitPuffin has joined #ocaml
milosn has joined #ocaml
elfring has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
jonludlam has quit [Ping timeout: 264 seconds]
jbrown has joined #ocaml
agarie has joined #ocaml
dsheets has quit [Ping timeout: 256 seconds]
raphaelss has joined #ocaml
dsheets has joined #ocaml
jbrown has quit [Ping timeout: 256 seconds]
raphaelss has left #ocaml [#ocaml]
<haesbaert>
what is the common path to parse binary data ? (network packet)
<haesbaert>
any special module I should look into ?
darkf has quit [Quit: Leaving]
<haesbaert>
think cstructs is what I want
<Leonidas>
haesbaert: also bitmatch might be nice
<Drup>
you mean bistring ?
<Leonidas>
I wish it were updated to use ppx insteat of camlp4
<Leonidas>
Drup: bitstring, even.
<Leonidas>
:)
<Drup>
yes
milosn has quit [Ping timeout: 264 seconds]
<haesbaert>
ack, will look into
seanmcl has joined #ocaml
BitPuffin has quit [Remote host closed the connection]
BitPuffin has joined #ocaml
oscar_toro has joined #ocaml
ptc has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
agarie has quit [Remote host closed the connection]
martintrojer has joined #ocaml
nojb has joined #ocaml
elfring_ has joined #ocaml
elfring has quit [Read error: Connection reset by peer]
Haudegen has quit [Ping timeout: 264 seconds]
<tane>
what's the way to use lwt syntax extension via campl4o with ppx_deriving? It seems a chain ppx -> campl4o -> compiler is needed, but defaults to camp4o -> ppx, leading to errors
<Drup>
use lwt.ppx instead of the camlp4 syntax extension
<tane>
thanks
<Drup>
camlp4 is incompatible with most ppx, you can't do anything about it
<Drup>
tane: beware, the syntax is a little bit different
nojb has quit [Ping timeout: 264 seconds]
nojb has joined #ocaml
Haudegen has joined #ocaml
elfring_ has quit [Ping timeout: 246 seconds]
elfring has joined #ocaml
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tel has joined #ocaml
ollehar1 has quit [Quit: ollehar1]
cesar_ has joined #ocaml
cesar_ is now known as Guest21834
seanmcl has joined #ocaml
badon has quit [Read error: Connection reset by peer]
badon has joined #ocaml
Denommus has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
oscar_toro has quit [Ping timeout: 256 seconds]
olibjerd has left #ocaml [#ocaml]
Guest21834 has quit [Ping timeout: 256 seconds]
seanmcl has quit [Client Quit]
elfring_ has joined #ocaml
elfring has quit [Read error: Connection reset by peer]
<j0sh>
is there a way define a type so a function can return itself without using -rectypes? eg, let rec f x = f
<nojb>
let rec f x = f x ?
<Drup>
j0sh: no, but I'm wondering why you would want that :)
<Drup>
(it's clearly not typable)
<Drup>
nojb: that's just infinite recursion, not "returns itself"
<asmanur>
j0sh: use a datatype: let f x = `A f
milosn has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
seanmcl has joined #ocaml
<companion_cube>
will ocamldep be no-alias-dep aware in the next OCaml?
s1n4 has quit [Quit: leaving]
agarie has joined #ocaml
<j0sh>
Drup: yeah basically infinite recursion, i want to loop over some input forever
<j0sh>
seems like it'd make writing accumulators easier by having the function return itself rather than having to carry around state explicitly
<j0sh>
(if that makes any sense at all)
tel has quit [Ping timeout: 272 seconds]
<ggole>
How does that help?
agarie has quit [Ping timeout: 264 seconds]
Submarine has joined #ocaml
<ggole>
If you already have the function value, you don't need to call it to get it again
<j0sh>
ggole: hard to explain, but its basically a parser for network input
<Drup>
those seems to be popular.
<j0sh>
so it'd be nice to be able to say
<j0sh>
"call function A, but if the parse is in some state X, call function B instead"
<ggole>
Ah, so you are returning the next function
<ggole>
One of the possibilities being the same thing agin
<j0sh>
so it'd be nice to just return A or B for the next round of consumption instead of the state
<j0sh>
yes exactly
<ggole>
Gotcha
<ggole>
Well, you need either -rectypes or to go through a constructor for that.
<ggole>
(As asmanur suggested.)
ptc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<j0sh>
asmanur: missed your suggestion, will try that out, thanks
srcerer has quit [Ping timeout: 250 seconds]
tel has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
<ggole>
Oops, I suggested any constructor would do but I had -rectypes on :)
<ggole>
(Polymorphic variants or objects should work.)
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
<Drup>
j0sh: if you really want do that, you might be better off with CPS
ghostpl_ has joined #ocaml
psy_ has quit [Remote host closed the connection]
<j0sh>
asmanur: wow, works nicely with polymorphic variant constructor... weird that the polymorphic variant doesn't have to be defined beforehand (not that i would really know how to define one for this situation anyway)
<j0sh>
Drup: wouldn't CPS eventually run into the same problem when it tries to loop back into the original state of the parse?
<Drup>
I don't think so, because the recrusive type is not exposed anywhere
freling has joined #ocaml
malc_ has joined #ocaml
<j0sh>
hmm, alright. funny, worked on this problem for hours last night, looked at CPS and Y combinators etc... gave up, went to bed, had a better idea to just ask on irc and sure enough its basically a one liner :)
Sorella has joined #ocaml
ollehar has joined #ocaml
jwatzman|work has joined #ocaml
thomasga has quit [Quit: Leaving.]
dav has quit [Ping timeout: 252 seconds]
shinnya has joined #ocaml
psy has joined #ocaml
psy has quit [Max SendQ exceeded]
psy has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
<haesbaert>
did I understand this right, if I define a record, and I want to use it on other modules, I'll have to define it in the record.ml _AND_ in record.mli ?
<Drup>
yes
<mrvn>
depends on the definition of "use"
<haesbaert>
I want the other modules to access the members of the record freely
<mrvn>
the labels are only visible if they are in the mli files
<mrvn>
(which means yes)
<haesbaert>
ack, can I hide some labels of the record on the mli ?
<nojb>
not just a record - anything that is not listed in the mli will be invisible to other modules
<nojb>
no
<mrvn>
haesbaert: you can keep the record abstract and provide getter functions for the parts visible.
<haesbaert>
mrvn: I considered that, but in this case is not what I want
<mrvn>
you can move the private parts into a subrecord that you keep private
<haesbaert>
ack
ptc has joined #ocaml
<mrvn>
next thing would be using objects
psy has quit [Disconnected by services]
<haesbaert>
so far I just need all the members to be accessed, it's just a packet dhcp record
<mrvn>
are you using mirage?
<nojb>
haesbaert: depending on what you are doing, you might want to leave the packet in binary form and directly access its fields - see cstruct for some utilities to make this easier
<haesbaert>
mrvn: no
<haesbaert>
nojb: I'm using cstructs to pack<->unpack the packet
<nojb>
cstruct has a camlp4 extension to define field getters/setters as well ...
<haesbaert>
ack, I'm using it, too bad merlin doesn't support it :(
<haesbaert>
mrvn: I'm just inventing things to code, a dhcpd seems simple enough given my current level of ocaml
<mrvn>
haesbaert: I would have gone for ntp(client)
<haesbaert>
I actually considered it, but I wanted something I really use
<haesbaert>
I do, but integrating with the system would be a pain in the ass
<haesbaert>
next I want to rewrite openmdns in ocaml
matason has quit [Ping timeout: 246 seconds]
agarie has joined #ocaml
<haesbaert>
nojb: ack, I'm looking at that code already
ggole has quit []
|jbrown| has joined #ocaml
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
seanmcl has joined #ocaml
<josch_>
adrien_znc, dmbaturin, def`: thanks a lot for your help a few hours ago! Thanks to your suggestions I was able to cook up a ocamllex based parser that understands shell quoting and escapes :) See http://stackoverflow.com/a/29418807/784669 if you like
cesar_ has joined #ocaml
cesar_ is now known as Guest84683
Gama11 has quit [Ping timeout: 272 seconds]
Gama11 has joined #ocaml
dav_ has joined #ocaml
dav_ is now known as dav-
Guest84683 has quit [Ping timeout: 256 seconds]
contempt has joined #ocaml
dav- has quit [Ping timeout: 252 seconds]
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
<xificurC>
Sort.List my_comparator my_list <-- how does one sort descending? Is there something that reverses the comparator?
agarie has quit [Read error: Connection reset by peer]
<companion_cube>
is it a Core function?
rand000 has joined #ocaml
<mrvn>
xificurC: invert the comparator
agarie has joined #ocaml
<mrvn>
(fun x y -> my_comparator y x)
malc_ has quit [Ping timeout: 250 seconds]
MrScout has quit [Ping timeout: 256 seconds]
mcclurmc has quit [Remote host closed the connection]
oriba has joined #ocaml
martintrojer has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<haesbaert>
hmm how do I make unsigned 32 bit arithmetics ?
<haesbaert>
I see there is a signed int32 module
<mrvn>
int32 is signed
<nojb>
there is a uint package
<mrvn>
and ocaml-uint has an unsigend module
<haesbaert>
ack
lordkryss has joined #ocaml
tel has quit [Ping timeout: 250 seconds]
olibjerd has joined #ocaml
olibjerd has quit [Remote host closed the connection]
nojb has quit [Quit: nojb]
mv has joined #ocaml
jc1 has left #ocaml [#ocaml]
agarie has quit [Remote host closed the connection]
nojb has joined #ocaml
MrScout has joined #ocaml
ontologiae has joined #ocaml
avsm has quit [Quit: Leaving.]
mort___ has quit [Ping timeout: 272 seconds]
agarie has joined #ocaml
<xificurC>
sorry had to step away
<xificurC>
companion_cube: no I don't use core
<xificurC>
mrvn: yeah that makes sense, now that you mention it I used flip in haskell, which you just defined
zozozo has quit [Ping timeout: 256 seconds]
<xificurC>
ok not flip but something similar
<companion_cube>
where does this function come from?
<xificurC>
companion_cube: the comparator? Most are [@@deriving ord], one is hand-coded
zozozo has joined #ocaml
elfring_ has quit [Quit: Konversation terminated!]
<xificurC>
let flip f = fun x y -> f y x
elfring has joined #ocaml
nojb has quit [Quit: nojb]
<xificurC>
widely used in haskell, probably not so important here
<Drup>
Ocamlers are not fond of point-free combinators like that
<companion_cube>
xificurC: I meant the sort function. anyway.
<ollehar>
I used `opam source ounit` and `opam pin add ounit /bla/ounit`. Now I need to tell opam to recompile, but `opam upgrade` doesn't do anything.
<Drup>
reinstall
<xificurC>
companion_cube: List.sort
<companion_cube>
ok
<Drup>
ollehar: also, update before upgrade
<ollehar>
drup thanks, will try
<Drup>
opam should pick up changes in the directory, with update
<xificurC>
you can't type-check if a list has a specific length, right
<mrvn>
xificurC: wrong
<Drup>
but you don't want to do it :D
<mrvn>
xificurC: you can create a List module with phantom types or GADTs that encode the lists length in its type.
<mrvn>
It isn't pretty to use
<Drup>
(gadt is better)
<xificurC>
ok, thanks. That raises 2 more questions from deep within my memory
<Drup>
well, it's an interesting exercise to understand gadts
<xificurC>
1) Printf.printf - it's type, wth?
BitPuffin has quit [Ping timeout: 248 seconds]
<mrvn>
xificurC: simplified: It takes a function 'a -> unit and then all the arguments 'a entails.
<Leonidas>
mrvn: with an unlimited length of entries?
<xificurC>
('a, out_channel, unit) format -> 'a = <fun>
s1n4 has quit [Ping timeout: 264 seconds]
<mrvn>
Leonidas: yes
<Leonidas>
interesting, didn't knwo
<Leonidas>
*know
<Drup>
xificurC: there is a little bit of magic behind this
<Drup>
but basically, the compiler will look at the string format
<Drup>
("Numbers: %d" for example"
<mrvn>
Leonidas: you can encode decimal numbers into types. You get something like a 'D1 D5 D7 List.t' for a list with 157 items.
<Drup>
and say "hey, There is an int format there"
<Drup>
and will then replace 'a by int
<Leonidas>
mrvn: ah. that's a neat trick.
<mrvn>
'a by int -> unit actually
<Drup>
indeed.
<mrvn>
And for scanf it's the same except the result isn't unit
<xificurC>
what if there's multiple types encoded
<mrvn>
xificurC: "%d %f" gives int -> float -> unit
<xificurC>
and you said _compiler magic_, does that mean one couldn't write a function like printf by hand in ocaml?
<companion_cube>
indeed
<mrvn>
xificurC: the conversion from "%d %f" to format is magic.
<companion_cube>
xificurC: the compiler knows about format strings
<companion_cube>
the actual printing, it doesn't kno
<companion_cube>
w
<xificurC>
aaaah, you dirty cheaters :p
<companion_cube>
these days we could have {| format %s strings %a |} with ppx though
<xificurC>
that explains why the type says nothing to me
<xificurC>
one more, completely different question regarding the future type classes (if it is coming in the near future anyway) - is there a plan to rework some of the standard lib when it arrives?
zozozo has quit [Ping timeout: 272 seconds]
<Drup>
xificurC: you could, however, create a ppx magic to do it.
<companion_cube>
I think not, for compatibility reasons
<xificurC>
to introduce abstractions like Ord, Foldable etc
<companion_cube>
but major stdlibs will probably do
<companion_cube>
;)
<Drup>
arg, companion_cube said it before me
<xificurC>
yeah, so it might spawn many new libs (or a rework of the old ones)
<companion_cube>
I'm sure some of them will adopt it :)
<companion_cube>
(assuming modular implicits are in 4.03, which is not sure)
larhat has quit [Quit: Leaving.]
<xificurC>
e.g. ppx_deriving eq ord wouldn't need to produce functions like compare_mytype, they could just auto-implement a type class
<Drup>
I highly doubt they will be in 4.03
<companion_cube>
if Pierre's flambda is integrated, it will still be a nice release
<Drup>
and codoc's stuff
<xificurC>
thank you for all your answers and insight
kakadu has joined #ocaml
<Drup>
xificurC: considering how implicits works, you wouldn't even really need to change ppx_deriving
<Drup>
it's structural subtyping, so just having the function in the module (and opening the module as an implicit) would work
<xificurC>
any ocaml devs sitting in this channel?
<xificurC>
(just curious)
<Drup>
member of the core team ? no
<Drup>
people contributing, yes
<xificurC>
you seem to be guessing what will be in the next release instead of asking
<xificurC>
I see
ptc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<companion_cube>
Drup: don't you have to declare an implicit module
<companion_cube>
?
<Drup>
hum, you have, but it's not specific to a signature
<Drup>
well, ask def` x)
<companion_cube>
righ
<companion_cube>
t
freling has left #ocaml [#ocaml]
ptc has joined #ocaml
nojb has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
ollehar has quit [Ping timeout: 248 seconds]
shinnya has joined #ocaml
ghostpl_ has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest86833
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
Guest86833 has quit [Ping timeout: 256 seconds]
nojb has quit [Quit: nojb]
agarie has quit [Remote host closed the connection]
agarie has joined #ocaml
TheLemonMan has joined #ocaml
nojb has joined #ocaml
`eeks has joined #ocaml
`eeks has quit [Client Quit]
nojb has quit [Quit: nojb]
ontologiae has quit [Ping timeout: 252 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
badon has quit [Ping timeout: 264 seconds]
ollehar has joined #ocaml
mcclurmc_ has joined #ocaml
mcclurmc has quit [Read error: Connection reset by peer]
kushal has joined #ocaml
jwatzman|work has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
ollehar has quit [Quit: ollehar]
BitPuffin has joined #ocaml
BitPuffin has quit [Ping timeout: 250 seconds]
Haudegen has quit [Ping timeout: 250 seconds]
MrScout has quit [Ping timeout: 265 seconds]
seanmcl has joined #ocaml
srcerer has joined #ocaml
kushal has quit [Ping timeout: 248 seconds]
kushal has joined #ocaml
ptc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ptc has joined #ocaml
nojb has joined #ocaml
claudiuc has joined #ocaml
Haudegen has joined #ocaml
_andre has quit [Quit: leaving]
kushal has quit [Quit: Leaving]
MrScout has joined #ocaml
elfring has quit [Quit: Konversation terminated!]
|jbrown| has quit [Ping timeout: 255 seconds]
agarie has quit [Remote host closed the connection]
agarie has joined #ocaml
larhat has joined #ocaml
rwmjones_hol has quit [Read error: Connection reset by peer]
rwmjones_hol has joined #ocaml
|jbrown| has joined #ocaml
ptc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nicoo has quit [Quit: Back soon]
BitPuffin has joined #ocaml
nicoo has joined #ocaml
agarie has quit []
avsm has joined #ocaml
ptc has joined #ocaml
struktured has joined #ocaml
nojb has quit [Quit: nojb]
MrScout_ has joined #ocaml
jwatzman2 has joined #ocaml
n_v has joined #ocaml
bitbckt has quit [Ping timeout: 256 seconds]
S11001001 has quit [Ping timeout: 256 seconds]
struk|desk2 has joined #ocaml
jwatzman|work has quit [Ping timeout: 256 seconds]
brendan has quit [Ping timeout: 256 seconds]
ericbmerritt_ has joined #ocaml
lordkryss_ has joined #ocaml
imslavko_ has joined #ocaml
lordkryss has quit [Ping timeout: 265 seconds]
MrScout has quit [Ping timeout: 265 seconds]
ericbmerritt has quit [Ping timeout: 265 seconds]
n0v has quit [Ping timeout: 265 seconds]
imslavko has quit [Ping timeout: 265 seconds]
struk|desk has quit [Ping timeout: 265 seconds]
mawuli has quit [Ping timeout: 265 seconds]
n_v is now known as n0v
ericbmerritt_ is now known as ericbmerritt
lordkryss_ is now known as lordkryss
brendan has joined #ocaml
bitbckt has joined #ocaml
imslavko_ is now known as imslavko
ptc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
S11001001 has joined #ocaml
mawuli has joined #ocaml
ontologiae has joined #ocaml
|jbrown| has quit [Ping timeout: 256 seconds]
ontologiae has quit [Ping timeout: 245 seconds]
tane has quit [Quit: Verlassend]
avsm has quit [Quit: Leaving.]
rossberg_ has quit [Read error: Connection reset by peer]
uris77 has quit [Ping timeout: 244 seconds]
Gama11 has quit [Read error: Connection reset by peer]
javamonn has quit [Remote host closed the connection]
ptc has joined #ocaml
jwatzman2 is now known as jwatzman
jwatzman has quit [Changing host]
jwatzman has joined #ocaml
ptc has quit [Client Quit]
thomasga has joined #ocaml
matason has joined #ocaml
xificurC has quit [Ping timeout: 255 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
MercurialAlchemi has quit [Ping timeout: 255 seconds]
claudiuc has quit [Remote host closed the connection]
claudiuc has joined #ocaml
zozozo has joined #ocaml
claudiuc has quit [Ping timeout: 250 seconds]
nojb has joined #ocaml
Simn has quit [Quit: Leaving]
lordkryss has quit [Quit: Connection closed for inactivity]