adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
_whitelogger has joined #ocaml
vicfred has joined #ocaml
FreeBirdLjj has joined #ocaml
olle has quit [Ping timeout: 260 seconds]
olle has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
dborisog has joined #ocaml
mfp has quit [Ping timeout: 246 seconds]
pierpa has quit [Remote host closed the connection]
oriba has quit [Ping timeout: 260 seconds]
dckc has quit [Ping timeout: 272 seconds]
dborisog has quit [Ping timeout: 256 seconds]
FreeBirdLjj has joined #ocaml
HyperTables has joined #ocaml
<HyperTables> I'm trying to preprocess with cppo but it seems I lose contextual errors that way. is this normal/expected? it's a bit of a bummer
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
<HyperTables> is there an identity function in the standard library or such?
<HyperTables> it seems to be in batteries hm
dckc has joined #ocaml
remexre has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
dborisog has joined #ocaml
zebrag has joined #ocaml
inkbottle has quit [Ping timeout: 246 seconds]
malc_ has joined #ocaml
malc_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 272 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
conjunctive has joined #ocaml
<flux1> flip and identity, functions that are exist in all non-trivial ocaml programs ;)
<flux1> (-are)
Anarchos has joined #ocaml
presiden has joined #ocaml
<presiden> What does opt in ocamlopt stands for?
<Anarchos> presiden optimized aka native code
<presiden> I see
<Anarchos> or optimal speed ?
<Anarchos> cause native code is not always optimized
zozozo has joined #ocaml
zozozo has quit [Ping timeout: 256 seconds]
labor[m] has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Ping timeout: 256 seconds]
khady[m] has quit [Ping timeout: 256 seconds]
mbuf has joined #ocaml
aecepoglu[m] has quit [Ping timeout: 256 seconds]
zozozo has quit [Ping timeout: 256 seconds]
vicfred has quit [*.net *.split]
rpcope has quit [*.net *.split]
cbarrett has quit [*.net *.split]
conjunctive has quit [*.net *.split]
j14159 has quit [*.net *.split]
sspi__ has quit [*.net *.split]
SrPx has quit [*.net *.split]
l1x has quit [*.net *.split]
JSharp has quit [*.net *.split]
bitonic has quit [*.net *.split]
bytesighs has quit [*.net *.split]
eagleflo has quit [*.net *.split]
h11 has quit [*.net *.split]
c4rc4s has quit [*.net *.split]
copy has quit [*.net *.split]
TakinOver has quit [*.net *.split]
hannes has quit [*.net *.split]
catern has quit [*.net *.split]
tianon has quit [*.net *.split]
banjiewen has quit [*.net *.split]
cemerick has quit [*.net *.split]
_whitelogger has joined #ocaml
<flux1> and ocamlc doesn't do optimizations to speak of
<Anarchos> flux1 even with flambda ?
<flux1> no idea really about that. but at least that is a historical explanation :).
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<Armael> flambda is only for native code, not bytecode
<Armael> so, no
<flux1> is there an OCaml library for converting int to Unix.file_descr and vice versa, or do I just need to type in the Obj.magic myself?-(
<flux1> indeed, there's unix-type-representations by Jeremy Yallop
Haudegen has joined #ocaml
mfp has joined #ocaml
<flux1> I wonder if OCaml programming introductions involving exceptions teach always doing this: `Printexc.register_printer (function Pg.Error error -> Some (Pg.string_of_error error) | _ -> None)` for your exceptions. increases quality of life with debugging with little effort.
<flux1> in fact, would it be such a bad idea if that mechanism was just built into the compiler 🤔
<flux1> I guess it too would require too much magic to determine the string_of_error-function
<zozozo> well, the compiler already has some builtin mechanism to automatically print the name of the exception (and the arguments when they are integers I think), but inferring a print function for the arguments would be too complex I think
<flux1> yes, but indeed the information it prints is limited
<flux1> and people often remember to write those stringifiers, but don't remember to register them
<flux1> also another point I noticed while writing an OCaml program since a long pause: preferably one exception per module, and that exception is a sum-type. it's just as easy to use and pattern match, but much easier to match all exceptions of a module at once.
<zozozo> well, in a real program, you'd expect to catch these exn and print a proper error message, but in the top-level it mihgt be useful
<flux1> I think in a real program there are so many sources of errors that you don't have just one place to deal with them :), you build them in basically with the string_of_error-mechanism on all levels
<flux1> unless that real program needs to be translated to different languages, then you need to give a real thought to it..
<flux1> (though probably nothing to bad probably: just have a localized_of_error which takes a localization argument)
<zozozo> well, typically, in my programs, a have a catch-all exn at the top-level of the program, to catch the exns, print an error message, and then exit with an error code
<zozozo> Which helps formatting the message better by using format, rather tha having to produce a string
<flux1> do you construct the error message in your main program?
<zozozo> flux1: well, I often have a dedicated module for printing errers, e.g. https://github.com/Gbury/dolmen/blob/master/src/bin/errors.ml
<flux1> for example this program parses YAML, lexes influxdb line format, interacts with PostgreSQL dataabase; I think it's just more practical to have the relevant error messages produced in those particular modules
<flux1> zozozo: well, difficult to argue with good results :)
<zozozo> well it is reasonable, but the use of strings is pretty limiting in terms of formatting the error message
<flux1> I'm usually just happy with the functionality+ease-of-implementation.
Exagone313 has quit [Quit: see ya!]
bronsen has joined #ocaml
jnavila has joined #ocaml
Exagone313 has joined #ocaml
jnavila has quit [Quit: Konversation terminated!]
jnavila has joined #ocaml
Exagone313 has quit [Quit: see ya!]
tane has joined #ocaml
Exagone313 has joined #ocaml
Exagone313 has quit [Client Quit]
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
Exagone313 has joined #ocaml
rockethead has joined #ocaml
<flux1> hmph, I guess this https://github.com/ocamllabs/dune-release/issues/128 didn't yet get integrated. what's the best way to stick git version inside my binaries?
<flux1> oops, this one instead: https://github.com/ocaml/dune/pull/1930
Serpent7776 has quit [Ping timeout: 256 seconds]
<flux1> oh apparently it did, I just needed to install dune-build-info
rockethead has quit [Quit: Leaving]
rockethead has joined #ocaml
Serpent7776 has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
<flux1> but then I realize it doesn't support `git describe --tags` which is really nice ;(
<flux1> final solution: `(rule (targets version.ml) (action (run sh -c "git describe --tags --always --dirty | sed 's/.*/let version = \"&\"/' > %{targets}")))`
<flux1> ..with appropriate version.mli
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
olle_ has joined #ocaml
<flux1> the only limitation is that it probably doesn't get updated without `dune clean`, but that's fine for my use
<zozozo> flux1: you could always make the rule depend on world/everything, but then you'll recompile things a lot I think
<flux1> maybe not, because it has the mli-file, so it should only do the linking again
<flux1> zozozo: thanks for the hint!
<flux1> zozozo: ..do you have a particular idea how to do that, though?-)
<zozozo> flux1: you can have (universe) as a dep, see https://dune.readthedocs.io/en/stable/concepts.html#deps-field
<zozozo> or depend on the .git directory
<flux1> so it's `(deps (universe))`. I'm not sure if depending on the directory would be sufficient.
<flux1> actually it's so smart that it caches the result of that command
<flux1> so it only rebuilds when I actually ie. git tag
<flux1> a no-changes-build takes 0.2 seconds and changin tag takes 1.3 seconds so I think this is easily the best solution for me
<zozozo> nice
FreeBirdLjj has joined #ocaml
<flux1> something I've been working for a couple weeks: https://github.com/eras/influxdb-write-to-postgresql
<flux1> ..pushed v0.99, I guess I should try it for the actual use case I was making it for before tagging v1.0..
<flux1> (heh, didn't work)
olle_ has quit [Ping timeout: 246 seconds]
Anarchos has joined #ocaml
rockethead has quit [Remote host closed the connection]
waleee-cl has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
rockethead has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
bartholin has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
mbuf has quit [Quit: Leaving]
<presiden> just like Float.pi, is there euler constant (e) somewhere in some module or should I use `exp 1` instad?
dborisog has quit [Ping timeout: 264 seconds]
<octachron> You should use "exp 1.".
<flux1> funnily enough, Float.pi as well was unavailable for the longest time
<octachron> When pi was added, it was not clear if "e" was really often used as a constant.
<flux1> ..but there was `4.0 *. atan 1.0`, so why put waste a symbol?
<flux1> octachron: I guess that's a reasonable argument, but on the other hand, it would hardly be a problem given it would be inside the Float module..
<octachron> The problem is more where to stop. Typically, I have used the Euler-Mascheroni constant more often than e.
<flux1> I think e is a popular constant, though, even if not used that much. like rust ;).
<octachron> "pi = 4 atan 1" is a bit less obvious than "e = exp 1"
<Anarchos> let i = Float.sqrt(-1) :)
<octachron> Another way to look at it, "e" is a nice base for writing differential operator eigenvectors. But more often than not, you are more interested in the whole eigenvector or the eigenvalue.
waleee-cl has quit [Quit: Connection closed for inactivity]
<presiden> understanably
<flux1> but, when you do need it, you would expect it to be there. I mean OCaml's math library must be one of the, well, limited ones around there.
<flux1> JavaScript and C have the symbol ;)
<flux1> ..and the formula you are transcribing will also use 'e'
<octachron> or exp. Honestly, "e" is very low on my list in term of math library feature, compared to erf, erfc, gamma, beta, w, few hypergeometric functions, maybe some elliptic integrals?
Anarchos has quit [Ping timeout: 240 seconds]
waleee-cl has joined #ocaml
<octachron> Note that it might be a good idea to have it in the Float module, or in an universal constant module.
Haudegen has quit [Ping timeout: 265 seconds]
Haudegen has joined #ocaml
Hrundi_V_Bakshi has joined #ocaml
Jesin has quit [Quit: Leaving]
rockethead has quit [Remote host closed the connection]
rockethead has joined #ocaml
Jesin has joined #ocaml
jnavila has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
oriba has joined #ocaml
<oriba> which library can be recommended for http get/post requests?
<oriba> (also https needed)
zebrag has quit [Quit: Konversation terminated!]
rockethead_ has joined #ocaml
<Leonidas> cohttp?
rockethead has quit [Remote host closed the connection]
nicoo has quit [Remote host closed the connection]
rockethead_ has quit [Remote host closed the connection]
ziman has joined #ocaml
nicoo has joined #ocaml
rockethead_ has joined #ocaml
<ziman> hello! https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#ss:c-concrete-datatypes says that "A non-constant constructor declared with n arguments is represented by a block of size n, tagged with the constructor number", while I observe that such constructors seem to be represented as singleton blocks pointing to a tuple of arguments. Am I reading it wrong or is the documentation not accurate in
<ziman> this respect?
jnavila has joined #ocaml
<ziman> Or maybe I'm declaring them wrong? I used: type 'a ilist = | Nil | Cons of ('a * 'a ilist)
<zozozo> ziman: actually, you observed the difference between `type t = Foo of int * int` and `type t = Foo of (int * int)`
<ziman> ooh
<zozozo> it's the one case where the parenthesis have an actual impact on the semantics and not simply used for disambiguation
<ziman> that's where my sunday went :)
<ziman> of course, thank you!
<zozozo> ^^
Jesin has quit [Ping timeout: 256 seconds]
zebrag has joined #ocaml
<ziman> it indeed works!
<zozozo> ziman: btw, what did you use to know the actual layout of the values ?
tane has quit [Ping timeout: 256 seconds]
<ziman> i wrote a block tree structure dumper in C
tane has joined #ocaml
<ziman> at first i tried to look at just the tags but they did not make any sense
<ziman> so i wrote a FFI C function that takes any ocaml value, printfs its structure and returns unit
<zozozo> nice
<zozozo> I wrote something like that some time ago: https://github.com/Gbury/ocaml-memgraph
<zozozo> it allows to print the structure as graphs like https://github.com/Gbury/ocaml-memgraph/blob/master/examples/sum.svg
<ziman> i like the ocaml low-level representation, it looks really neat and powerful to me
jnavila has quit [Quit: Konversation terminated!]
<ziman> oh, nice
jnavila has joined #ocaml
<zozozo> you have a somewhat let's say mid-level abstraction of the low-level representation in src/repr.mli
<ziman> oh, apparently you can use Obj without descending down to C
<ziman> i know very little about ocaml so all this is new to me :)
<zozozo> yeah, though the use of the Obj module is reserved for people who know what they're doing, as it's very easy to break type safety with it
Anarchos has joined #ocaml
<zozozo> (though it's pretty much like any C code actually in that case, ^^)
<ziman> i'm very much breaking type safety here ;)
<zozozo> well, if you only inspect values, you're not breaking type safety of the ocaml code
<ziman> actually, yes, not anymore :)
<ziman> i'm trying to compile via malfunction and i want get_args to return a nice list in the guest language
<ziman> so now i can put it together using plain constructor calls
<ziman> rather than fiddling with blocks
<zozozo> intereting, I never really looked much into how malfunction was working, so I'm not really able to really get that, :p
<ziman> sorry, that was not very clear; I'm writing a compiler backend that generates code using https://github.com/stedolan/malfunction
jnavila has quit [Remote host closed the connection]
<zozozo> yeah, I know malfunction, just never really used it, :p
jnavila has joined #ocaml
<ziman> i find it really neat
<ziman> a bit of a pain to install
<zozozo> ^^
<ziman> but then you get to use the whole ocaml ecosystem
<zozozo> I wonder how much it will break if/when modifications will eb made to the backend of the compiler
<ziman> and codegen
<ziman> i think it requires modification with every minor version, so the last supported is 4.09, and 4.10 is not supported yet
<oriba> Leonidas: cohttp ... looked it up ... it uses other libraries (Lwt or Async). I try to keep the binaries small, do you know how big the binaries become with that lib? Did you used it?
rockethead_ has quit [Quit: Leaving]
rockethead has joined #ocaml
Anarchos has quit [Ping timeout: 240 seconds]
jnavila_ has joined #ocaml
jnavila has quit [Ping timeout: 256 seconds]
<oriba> Leonidas: ah there is an example... I can try it. thx for pointing me to cohttp
jnavila_ has quit [Quit: Konversation terminated!]
rockethead has quit [Quit: Leaving]
<oriba> oh, example does not compile
tane has quit [Quit: Leaving]
lubegasimon[m] has quit [*.net *.split]
bglm[m] has quit [*.net *.split]
lubegasimon[m] has joined #ocaml
bglm[m] has joined #ocaml
oturtle has quit [*.net *.split]
sz0 has quit [*.net *.split]
robmyers has quit [*.net *.split]
adi_________ has quit [*.net *.split]
chewbranca has quit [*.net *.split]
oturtle has joined #ocaml
robmyers has joined #ocaml
sz0 has joined #ocaml
chewbranca has joined #ocaml
adi_________ has joined #ocaml
HyperTables has quit [*.net *.split]
HyperTables has joined #ocaml
rowbee has quit [*.net *.split]
p4bl01 has quit [*.net *.split]
schlaftier has quit [*.net *.split]
delysin has quit [*.net *.split]
engil has quit [*.net *.split]
trn has quit [*.net *.split]
johnel has quit [*.net *.split]
rowbee has joined #ocaml
p4bl01 has joined #ocaml
schlaftier has joined #ocaml
delysin has joined #ocaml
johnel has joined #ocaml
engil has joined #ocaml
trn has joined #ocaml
trn has quit [Max SendQ exceeded]
jimt[m] has quit [*.net *.split]
ahf has quit [*.net *.split]
flux1 has quit [*.net *.split]
foocraft[m] has quit [*.net *.split]
prsafont[m] has quit [*.net *.split]
dash has quit [*.net *.split]
RalfJ has quit [*.net *.split]
rom1504 has quit [*.net *.split]
foocraft[m] has joined #ocaml
dash has joined #ocaml
prsafont[m] has joined #ocaml
RalfJ has joined #ocaml
rom1504 has joined #ocaml
jimt[m] has joined #ocaml
ahf has joined #ocaml
flux1 has joined #ocaml
ahf has quit [Max SendQ exceeded]
flux1 has quit [Max SendQ exceeded]
trn has joined #ocaml
sepp2k has quit [Ping timeout: 240 seconds]
aecepoglu[m] has quit [*.net *.split]
simpson has quit [*.net *.split]
camlriot42 has quit [*.net *.split]
labor[m]1 has quit [Ping timeout: 244 seconds]
peddie has quit [Ping timeout: 244 seconds]
aspiwack[m] has quit [Ping timeout: 244 seconds]
lnxw37d4 has quit [Ping timeout: 244 seconds]
lubegasimon[m] has quit [Ping timeout: 244 seconds]
bglm[m] has quit [Ping timeout: 244 seconds]
jimt[m] has quit [Ping timeout: 252 seconds]
foocraft[m] has quit [Ping timeout: 252 seconds]
prsafont[m] has quit [Ping timeout: 252 seconds]
sz0 has quit [Ping timeout: 246 seconds]
robmyers has quit [Ping timeout: 246 seconds]
cgenie[m] has quit [Ping timeout: 260 seconds]
chewbranca has quit [Ping timeout: 246 seconds]
shmibs has quit [*.net *.split]
mrd has quit [*.net *.split]
cqc has quit [*.net *.split]
leah2 has quit [*.net *.split]
farn has quit [*.net *.split]
ebb has quit [*.net *.split]
thizanne has quit [*.net *.split]
iZsh has quit [*.net *.split]
iZsh has joined #ocaml
mrd has joined #ocaml
shmibs has joined #ocaml
leah2 has joined #ocaml
cqc has joined #ocaml
farn has joined #ocaml
ebb has joined #ocaml
thizanne has joined #ocaml
leah2 has quit [Max SendQ exceeded]
farn has quit [Max SendQ exceeded]
ziman has quit [*.net *.split]
vsiles has quit [*.net *.split]
White_Flame has quit [*.net *.split]
tmhoang has quit [*.net *.split]
madroach has quit [*.net *.split]
runawayfive has quit [*.net *.split]
TC01 has quit [*.net *.split]
ridcully has quit [*.net *.split]
kvik has quit [*.net *.split]
dx has quit [*.net *.split]
stux|RC-only has quit [*.net *.split]
DanielRichman has quit [*.net *.split]
adrien has quit [*.net *.split]
leah2 has joined #ocaml
ziman has joined #ocaml
dx has joined #ocaml
adrien has joined #ocaml
tmhoang has joined #ocaml
TC01 has joined #ocaml
runawayfive has joined #ocaml
ridcully has joined #ocaml
kvik has joined #ocaml
White_Flame has joined #ocaml
madroach has joined #ocaml
vsiles has joined #ocaml
stux|RC-only has joined #ocaml
DanielRichman has joined #ocaml
simpson has joined #ocaml
chewbranca has joined #ocaml
chewbranca has quit [Changing host]
chewbranca has joined #ocaml
chewbranca has joined #ocaml
chewbranca has quit [Changing host]
farn has joined #ocaml
dash has quit [Ping timeout: 252 seconds]
Manis[m] has quit [Ping timeout: 260 seconds]
robmyers has joined #ocaml
ahf has joined #ocaml
farn has quit [Read error: Connection reset by peer]
sz0 has joined #ocaml
farn has joined #ocaml
labor[m]1 has joined #ocaml
cgenie[m] has joined #ocaml
Hrundi_V_Bakshi has quit [Quit: No Ping reply in 180 seconds.]
Jesin has joined #ocaml
Hrundi_V_Bakshi has joined #ocaml
dash has joined #ocaml
Manis[m] has joined #ocaml
lubegasimon[m] has joined #ocaml
aspiwack[m] has joined #ocaml
prsafont[m] has joined #ocaml
sepp2k has joined #ocaml
aecepoglu[m] has joined #ocaml
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 246 seconds]
jimt[m] has joined #ocaml
peddie has joined #ocaml
camlriot42 has joined #ocaml
flux1 has joined #ocaml
foocraft[m] has joined #ocaml
bglm[m] has joined #ocaml
lnxw37d4 has joined #ocaml
Hrundi_V_Bakshi has quit [Ping timeout: 260 seconds]
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
zmt01 has quit [Read error: Connection reset by peer]
Haudegen has quit [Ping timeout: 246 seconds]
zmt00 has joined #ocaml