<orbifx>
Just checking I don't mind writing the matching, but it seems verbose when having one to one sequential matching.
<zozozo>
orbifx: as Drup said, try the 'enum' plugin of ppx_deriving
<orbifx>
Might do if I start getting long lists.
<zozozo>
I'd do it for any type with >= 2 constructors, :p
seangrove has joined #ocaml
lokien_ has joined #ocaml
<flux>
I would just use an editor macro to format the type definition into the code.
seangrove has quit [Ping timeout: 244 seconds]
picolino has quit [Ping timeout: 264 seconds]
butts_butts has quit [Ping timeout: 268 seconds]
struk|desk|away is now known as struk|desk
nicholasf has joined #ocaml
nicholasf has quit [Remote host closed the connection]
schive has quit [Quit: Leaving]
ggole has joined #ocaml
nicholasf has joined #ocaml
nicholasf has quit [Remote host closed the connection]
<orbifx>
zozozo: thatd a bit of a low threshold :-P
<zozozo>
I'm *very* lazy
<zozozo>
but then, it actually depends on how often I expect the type to change
nicholasf has joined #ocaml
Vintila has quit [Ping timeout: 260 seconds]
nicholasf has quit [Ping timeout: 248 seconds]
BitPuffin has joined #ocaml
<companion_cube>
gah, looks like the `sha` library is not maintained
sfri has quit [Remote host closed the connection]
<toolslive>
how do you convince the opam-repository's travis if the distro it's based on (ubuntu 12.04) does not have the c library you need ?
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 260 seconds]
jmbto has quit [Quit: WeeChat 1.3]
seangrove has joined #ocaml
struk|desk is now known as struk|desk|away
seangrove has quit [Ping timeout: 250 seconds]
<zozozo>
toolslive: I think opam lets you specify external dependencies
<toolslive>
yes, it does: via depext. so I can specify that I need the package. But alas, the distro is so old the library version I get does not have the include headers I need.
<zozozo>
hm.. seems like the trick is to have a virtual opam package that only installs correctly if the given C lib is present
<toolslive>
my library installs fine on a more recent ubuntu, but it seems that if I can't convince travis it will not be merged in into the opam repo.
<toolslive>
the problem is a bit that all this seems totally irrelevant as it only has use if you have the matching hardware (you need a rdma nic to be able to do something with the lib)
MercurialAlchemi has joined #ocaml
<flux>
companion_cube, what kind of maintenance would it need? string->bytes?
<companion_cube>
I don't know
<companion_cube>
there are PRs but they are not merged
<mrvn>
I'm trying to write a ppx plugin. I'm trying to add [%external ...] to class methods by matching class_field. But is there a simple way to get hold of the current class that is in?
<mrvn>
i.e. the name used in the class_declaration before that
foocraft_ has joined #ocaml
foocraft has quit [Ping timeout: 246 seconds]
seangrove has joined #ocaml
BitPuffin has quit [Read error: Connection reset by peer]
BitPuffin has joined #ocaml
struk|desk is now known as struk|desk|away
teiresias has joined #ocaml
leyyin has joined #ocaml
malc_ has joined #ocaml
malc_ has quit [Client Quit]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
lokien_ has quit [Quit: Connection closed for inactivity]
Algebr` has joined #ocaml
ibor1 has joined #ocaml
ibor has quit [Ping timeout: 252 seconds]
butts_butts has joined #ocaml
copy` has joined #ocaml
NingaLeaf has joined #ocaml
hxegon has quit [Quit: PEACE OUT]
julien_t has joined #ocaml
d0nn1e has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
rand__ has joined #ocaml
shinnya has joined #ocaml
jgjl has joined #ocaml
schive has joined #ocaml
julien_t has quit [Ping timeout: 244 seconds]
ontologiae has quit [Ping timeout: 244 seconds]
shinnya has quit [Ping timeout: 264 seconds]
foocraft_ has quit [Remote host closed the connection]
<edwin>
looks like you have to implement that virtual method and you get a new engine
Fistine has joined #ocaml
<toolslive>
rselect can handle rsockets but also plain file descriptors, so that might be an option
tobiasBora has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
<toolslive>
I fear I have to let both event loops run independently and then I have to translate the events between them, via something like a pipe or eventfd
<edwin>
ok I did that once too, the result isn't pretty though
<toolslive>
exactly
<edwin>
if you can have just 1 engine that'd be better
<edwin>
do you need to use Lwt_io and such on your rsockets?
<edwin>
cause that is something different than just supporting the event loop
dwillems has joined #ocaml
<toolslive>
well, that would be nice too (to have channels) but that's not absolutely necessary. just send/recv on bigarrays is good enough
<toolslive>
I have demoware of this where I wrap the calls in Lwt_preemptive.detach. of course that's not what I really want
<toolslive>
So, if I have my own Lwt_engine.poll based, all other file descriptor based functionality of lwt gets routed to this engine too ?
<ollehar>
just a quick check: anyone had this problem with ppx_deriving?
<ollehar>
This expression has type Ppx_deriving_runtime.string, expected string
<ollehar>
using ocaml 4.02.2, ppx_deriving 2.0 or 3.3
<psnively>
Hi everyone! Is there a general incantation for opam to have it install something by statically linking any stubs it has? In particular, it looks like bin_prot relies on C stubs and dynamic linking (at least by default). I’m trying out ocaml-musl-static, so that’s stopping me from using core, hence async_core, cohttp…
dwillems has quit [Ping timeout: 244 seconds]
<edwin>
toolslive: if you Lwt_engine.set the new engine, then everything in lwt that deals with file descriptors and timeouts should get router there yes
<toolslive>
that's perfect... going to try that after the weekend.
<edwin>
but well if you want examples on how to implement lwt engines you can look
<edwin>
psnively: if I want a fully static executable I edit the final linker options, trying to build every library with -static breaks too many things
<edwin>
psnively: if you're using _oasis then NativeOpt+: -cclib -static on your executable might do the trick
avsej has joined #ocaml
<psnively>
edwin: OK, but let’s say I want to try just ONE library… sorry, but is there a straightforward opam invocation to at least try? :-)
<octachron>
ollehar, it may be a compatibility problem, attribute rules changed between 4.02.2 and 4.02.3
<edwin>
psnively: opam switch 4.02.3+musl (if you're on Debian or otherwise have a musl-gcc compiler), this just gives you a musl based environment (still dynamic linking)
<psnively>
edwin: Yeah. I’ll probably end up doing that in the end, for what I ultimately want to build. It’d just be nice if I could say “please at least try to install this statically.”
<edwin>
then opam install your library, and then link your executable with -sttaic
<ollehar>
octachron: hmmm, I'll try with 4.02.1.
<avsej>
hi guys. I'm trying to build ocaml on openindiana (its is a fork of opensolaris) and have couple of issues. For example here https://github.com/ocaml/ocaml/blob/trunk/configure#L915-L916 it uses assembler and C compiler from GNU, but preprocessor from solaris studio, it does not compile with such setting
<psnively>
edwin: Right. I actually switched to ocaml-4.02.3-musl-static, hoping to shortcut all that.
<edwin>
yeah I didn't have much luck with ocaml-4.02.3-musl-static, except for very simple ocaml apps with no dependencies
<ollehar>
octachron: what is attribute rules?
<ollehar>
ppx?
<psnively>
edwin: heh.
<edwin>
its a problem with those libraries's build systems, not opam itself. They try to build .cmxs and fail
<edwin>
nowadays I prefer to use docker instead of static linking (there are some prebuilt docker images for ocaml/opam for various distros)
<octachron>
ollehar, the rules defining how the attributes [@@...] are attached to syntax items
<ollehar>
ok
<psnively>
edwin: Right. I’m just trying to port a silly orchestration thing that’s in Python, and that would be a good use-case for Go, to OCaml, but I like the standalone-binary idea.
<psnively>
edwin: It’s frustrating, because of all of core, the ONLY thing that seems to rely on dynamic linking of stubs is bin_prot.
<octachron>
ollehar, as far as I remember, this created some problems for ppx_deriving during the transition from 4.02.2 to 4.02.3
<ollehar>
octachron: good to know.
djellemah_ has quit [Ping timeout: 260 seconds]
<Algebr>
/#join iphonedev
<Algebr>
bah
Haudegen has joined #ocaml
<Algebr>
/#join iphonedev
<ollehar>
octachron: same problem on 4.02.1...
<Algebr>
!!
<ollehar>
strange
<octachron>
ollehar, and with 4.02.3 ?
<ollehar>
will try
<avsej>
okay, I managed to build it on solaris, I will make a pull request
<malc_>
Algebr: wow
* malc_
higher forces tell you to comment the thing out, think about it
<Algebr>
ha
Maelan has joined #ocaml
<ollehar>
octachron: same error! :(
<edwin>
avsej: someone told me once to use this on OmniOS, don't know if it helps: ./configure -cc "gcc -m64" -as "gas --64" -aspp "gcc -m64 -c" -partialld "ld -r -64"
<avsej>
at the moment, I'm building 32bit version
<edwin>
with the 32-bit version I think I had some more troubles
leyyin has quit [Quit: So Long, and Thanks for All the Fish]
<orbitz>
Is the use of GADTs a performance hack? If so, how?
<fds>
Is there any way to say that a file needs e.g. str.cmxa or unix.cmxa from within the file? Rather than passing it as an option to the compiler or using a _tags file?
<mrvn>
orbitz: a GADT is just a constructor like any variant type. Except the type system behaves differently.
<Drup>
fds: Why don't you want to use the _tags file ?
<mrvn>
orbitz: type t = Foo of int | Bar of float is the same speed as type _ t = Foo : int -> int t | Bar : float -> float t
<mrvn>
fds: say to whom?
<mrvn>
I'm using oasis and ./configure says: "Turn ocaml debug flag on: ............................ true". How to I check that flag in C stubs?
<fds>
Drup: Because I'm submitting the solution to a silly programming problem to a website which compiles my solution automatically.
<fds>
mrvn: ^
<Drup>
No way, then no
<mrvn>
fds: just add str.cmxa to the compile argument
<fds>
mrvn: I don't have control over the command they run to compile.
<fds>
I suppose I should submit a bug report to the site or something.
<mrvn>
fds: cut&paste the source for str.ml into your code?
<Drup>
:cringe:
<mrvn>
what do you need str for?
<smondet>
orbitz: (not sure but) I think the performance hack is to make all the cases nullary variants (unboxing + special pattern-match) and passing the Span.t separately while staying well-typed
<fds>
I'm actually just using it to split a string. But it's the principle!
<mrvn>
smondet: that would be an optimization. ocamlopt doesn't even do that
<Drup>
fds: don't use Str to split string, but I agree with you!
<fds>
In fact, why is it that only some of the modules require you to pass the cm(x)a to the compiler?
<fds>
Drup: What should I use?
<Drup>
virtually anything else
<Maelan>
fds, maybe a shebang-related hack, or a polyglotte source file?
<mrvn>
fds: they all do, except the stdlib cmxa is there implicitly
<mrvn>
fds: is it bytecode or native? Do they have findlib?
<Maelan>
this is what i do for ocaml scripts that need e·g· unix.cma
<mrvn>
#require "package";; to load a package
<Maelan>
that would be a serious security hole though
<mrvn>
fds: why not convert string to char list and pattern match the list to split?
<orbitz>
mrvn: I'm afraid i still don't understand what the optimization is that the comment refers to
<mrvn>
Maelan: depends on what modules are available. But if they have unix then *BOOM*
<mrvn>
orbitz: Say you have a function buzz that accepts type t = Foo | Bar. Then you can compile a optimized version buzz_Foo that only accept Foo and buzz_Bar that only acepts Bar. Then you don't have to pass the box as argument anymore.
<fds>
mrvn: I suppose my question is ``Why doesn't stdlib.cmxa contain all the modules listed in the manual?'' then.
<mrvn>
orbitz: in places the compiler knows wether you have a Foo or a Bar as argument it can call the optimized version.
<orbitz>
mrvn: ahh ok
<orbitz>
thank you
<fds>
Maelan: Have you got an example of such a shebang-related hack?
<mrvn>
fds: because ocaml for the longest time couldn't link in only the needed parts and all your binaries would become huge.
<fds>
mrvn: Ah, I see.
<orbitz>
mrvn: is that an implementation detail of how gadts are done in ocaml or something more general?
<mrvn>
orbitz: but as said ocaml doesn't even do that so far. I'm not sure if that new flambda thing mentioned on the ml does it.
<orbitz>
ah ok
<fds>
For now I'll probably just implement the split myself.
<mrvn>
orbitz: that is a really general optimization. gcc does it for everything. Certainly not limited to GADT, that's just a special typesystem thing that boils down to simple variant types internally.
<mrvn>
orbitz: in gcc if you call foo(1, ...) it will optimize the code for foo for the case that the first argument is 1 (if it cosniders it worth it).
<orbitz>
right, I just wasn't curious if this was actually the case in ocaml. The comment is quite unclear :)
<mrvn>
orbitz: check out flambda.
<Maelan>
fds, after thinking about it for some seconds, i realized that for this to work the submission server must accept and run sh code, and i doubt it is the case
<mrvn>
Is there something better than using this in _oasis? CCOpt: `pkg-config --cflags Qt5Widgets` -x c++ -std=gnu++11 -Wno-pmf-conversions -O2 -W -Wall -fno-inline `if $debug; then printf -- "-DDEBUG=DEBUG"; fi`
<fds>
Maelan: Ah, no problem.
demonimin has joined #ocaml
<Maelan>
(the shebang itself would not be useful in this case anyway, only the polyglot aspect, but the same effect (i·e· executing ocaml code) could certainly be achieved by other (less funny) means
<Maelan>
)
djellemah has joined #ocaml
<mrvn>
I wonder how much software parses ocaml versions as octal and what will break for 4.08
<mrvn>
(spit at ., convert each part to int, *BOOM*)
Haudegen has quit [Ping timeout: 264 seconds]
<companion_cube>
in OCaml, octal is 0o13, not 013
MercurialAlchemi has quit [Ping timeout: 244 seconds]
<mrvn>
companion_cube: didn't say the software doing the scanning needs to be ocaml