<maker>
hm, hello again. I am parsing this two files (pem stuff); I need to fetch some data from both of them, then store it in a record. So far I came up with a nested matching, but it doesn't look very elegant. Is there anything ideomatic in ocaml for this cases?
<maker>
Specifically, I am doing this:
<aluuu>
In a nutshell, my question is: is there any way to disable _tags file autogeneration in oasis or could I generate _tags with optional package usage with the help of oasis?
<maker>
match parse_foo foo with | [`AAA aaa] -> match parse_bar bar with | [`BBB bbb] -> {a=aaa; b=bbb}
<maker>
(plus matching for errors)
bba has joined #ocaml
nicholasf has quit [Read error: Connection reset by peer]
nicholasf has joined #ocaml
<Algebr>
aluuu: I don't understand the issue, you do opam remove lwt but then want to build something that uses lwt.unix?
Simn has joined #ocaml
<Algebr>
maker: maybe match parse_foo foo, parse_bar bar with
<maker>
Algebr: oh lovely, I didn't think about it
<maker>
thanks!
<flux>
on the other hand sometimes you want to avoid executing the other part, in that case you can do match parse_foo foo, lazy (parse_bar bar) with | [`AAA a], lazy [`BBB b] -> { a; b }
<flux>
of course makes no sense if you always match it and have only one match pattern :-)
<Algebr>
aluuu: ah lame, its still using lwt even though --disable-lwt. Where does the --disable-lwt flag come from
<maker>
flux: sweet, this could be the first time I manage to use this lazy thing
<Algebr>
maker: another usage of lazy I've found is for holding the original value of somethign just in case to present in case of error or whatnot
<Algebr>
ah
<maker>
an example of this?
<aluuu>
Algebr: I've spotted strange thing in auto-generated _tags file: package(lwt) tag is defined for all files in src directory, so ocamlbuild tries to build all files in src with lwt package required.
<maker>
I can't picture it myself - everytime I can think of something that's already computed
<flux>
maker, I've used 'lazy' for loading bitmaps and then using List.iter for processing said bitmaps
<flux>
maker, so the loading of the data is interleaved with the processing of said data
<maker>
yep
<Algebr>
aluuu: that does seem odd
<maker>
also is there a decent way for unittesting stuff on Lwt?
<aluuu>
maker: what do you mean by the term "decent"?
<maker>
aluuu: I mean OUnit seems could do the job, but I would need to start an Lwt loop for every test_ function
<aluuu>
maker: there are some test in ocaml-redis – written ones, used for both sync and lwt client testing.
<maker>
aluuu: also I am using the network so testing means I need to create a mock server
<flux>
heh, this was a pretty interesting use for lazy: let f = lazy (open_out .. ) in (* use f or don't use f, depending on input data *); if Lazy.is_val f then close_out (Lazy.force f)
<flux>
so if the code doesn't end up using f, the file won't get generated
<maker>
aluuu: ok, taking a look now
<aluuu>
maker: oh, i think mocking is a hard thing in ocaml
<flux>
not if the code is functor- or object-based regarding the object to be mocked ;). but I guess that's not the norm ;).
<flux>
..but in those cases mocking should be pretty nice!
<flux>
also it might be quite annoying to mock out complete modules like 'Unix', if you wanted to mock network operations..
<flux>
(well, I guess you can just limit the signature to the parts of Unix you make use of)
badon has quit [Read error: Connection reset by peer]
badon has joined #ocaml
<aluuu>
btw, mirage-tcpip provides great mocking capabilities for netwokring libraries
mistermetaphor has joined #ocaml
<flux>
hmm, did this switch 4.02.1+multicore exist a long time in opam or has it appeared just recently..
Algebr has quit [Remote host closed the connection]
mistermetaphor has quit [Ping timeout: 276 seconds]
A1977494 has joined #ocaml
<flux>
oh, I have even switched it, maybe it's some old unofficial :)
mettekou has joined #ocaml
Reshi has joined #ocaml
kushal has joined #ocaml
f[x] has joined #ocaml
<maker>
flux: making a functor only to allow mock object doesn't seem good anyway
<maker>
hannes: mm is there a way in X509 to convert a PEM into a DER?
<companion_cube>
flux: another possibility, if you implement network protocols, is to invert the control flow
<flux>
maker, well, it doesn't need to be the only reason, it also does decoupling
<companion_cube>
and have the protocol implementation be a kind of state machine
<companion_cube>
I think `imap` does this
<flux>
maker, and you get to see the dependencies very explicitly
Reshi has quit [Ping timeout: 244 seconds]
* maker
fears functors
ygrek_ has quit [Ping timeout: 276 seconds]
<flux>
you should try them! they're pretty neat!
pyon is now known as loli-pyon
<maker>
I used them for mirage
<maker>
then everything had to be inside the module
<companion_cube>
they're nice, but using them a lot can be difficult
<maker>
^ yes that's my understanding
<maker>
more than difficult, yeah, troublesome
<flux>
I guess in practice they make it more difficult to follow where the actual code flow goes
<flux>
can merlin follow modules that are reachable via a functor argument?
dsheets has joined #ocaml
<companion_cube>
yes
<flux>
I mean, it could at least give alternatives like rtags can find 'where is this referenced from', but in a bit another sense
<flux>
oh, cool :)
<companion_cube>
wait, you mean , for typing, or for 'goto def'?
<flux>
hmm, no
<flux>
let's say you have module MyCode = functor (U : module type of Unix) -> struct let foo = U.gettimeofday () end
<flux>
and then another piece of code that does module MyImpl = MyCode(Unix)
<flux>
and then you place your point over U.gettimeofday. Can you get to Unix.gettimeofday?
<companion_cube>
I don't think so, since it could correspond to several implementations
<companion_cube>
the same you cannot go to some list [1;2;3] within List.map
<flux>
yes. but in practice, there would be a limited number of applications withing an application; possibly even just exactly one
<flux>
so, much like a symbol can be references from multiple places, rtags (for c/c++) can find those places
dsheets has quit [Ping timeout: 250 seconds]
<companion_cube>
hmmm
<companion_cube>
"find instances" in IDEs, or something like this?
<flux>
yep
<companion_cube>
then I don't think so
<companion_cube>
it's probably harder in OCaml though
<flux>
for example in rtags I can go over struct { int a; } and the field 'a' and find all the places that make use of the particular field
<companion_cube>
it's like a reachability analysis, because the functor could also be passed as argument to another functor, etc.
<flux>
I think the problem of ocaml things often times is trying to get a 100% solution.. ;-)
<companion_cube>
well
<companion_cube>
yes, things are difficult
<companion_cube>
but merlin does an awesome job at what it tries to solve
<flux>
a lot of times functors are used without in the top-level without any particular dynamic control flow involved
<hannes>
maker: and how to read a file into a cstruct (or string) is out of scope (you can use Lwt_unix or Unix openfile and read for this)... Cstruct.of_string let's you create a cstruct.t
mistermetaphor has joined #ocaml
abruanese has joined #ocaml
A1977494 has quit [Quit: Leaving.]
mistermetaphor has quit [Ping timeout: 276 seconds]
<maker>
hannes: I want to do the following
<maker>
openssl req -in req.csr -outform DER
<maker>
where req.csr can be a string, and stdout is another string
<maker>
in ocaml
<maker>
or better, Cstruct.t types.
<maker>
no file operations, I am just trying to figure out how to make a der out of a pem
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<maker>
So I figured out myself (and you confirmed) that I can read a Pem certificate signing request. Now I want to have a der representation of it
<hannes>
maker: you don't get a DER of a CSR atm.. why would you have a DER stored somewhere?
<hannes>
(for certificates there's parse and cs_of_cert in Encoding, which are the DER -> certificate and certificate -> DER conversions)... maybe adding this for CSRs makes sense..
yegods has joined #ocaml
amnn has joined #ocaml
<M-martinklepsch>
gasche_ (IRC): I tried putting #use "topfind";;into .ocamlinit and evaluating it directly in the top level, in both cases I get Cannot find file topfind.
<maker>
hannes: I don't know why one should want it, but acme says at some point you have to take your csr and send the base64-encoded version of the der file:
<maker>
«The CSR is sent in the Base64url-encoded version of the DER format»
<maker>
anyways, back to cs
<maker>
hannes: "certificate_request_of_cs cs" what is a cs? a certificate signing request type?
<maker>
"signing_request", "request_info", or what?
atbagautdinov has quit [Ping timeout: 276 seconds]
profan has quit [Quit: Changing server]
dsheets has quit [Ping timeout: 260 seconds]
<M-martinklepsch>
Hey all :) I'm trying to get tuaregs default toplevel to be able to open Core but it always tells me the module is unbound. Someone suggested adding an ocamlinit with #use "topfind" but that didn't help either. Any other suggestions?
<M-martinklepsch>
error message after #use "topfind" is Cannot find file topfind.
Reshi has joined #ocaml
tobiasBo1 has quit [Quit: Kthxbye]
_y has quit [Read error: Connection reset by peer]
Reshi has quit [Ping timeout: 250 seconds]
atbagautdinov has joined #ocaml
<flux>
m-martinklepsch, do you have ocamlfind installed?
<flux>
aka findlib
<M-martinklepsch>
yes. v1.6.2
<M-martinklepsch>
I don't know if that's useful information but if I start utop then #require "core" and open Core.Std just works fine
nicholasf has quit []
octachron has joined #ocaml
lokien_ has joined #ocaml
<octachron>
M-martinklepsch, are you using your system ocaml compiler?
<maker>
so now I have merlin
<maker>
I just gave it sudo and installed it
* maker
throws holy water at the laptop
Reshi has joined #ocaml
iZsh has quit [Ping timeout: 276 seconds]
iZsh has joined #ocaml
shinnya_ has joined #ocaml
kushal has quit [Read error: Connection reset by peer]
ski__ has joined #ocaml
ungz has joined #ocaml
djellemah_ has quit [Ping timeout: 276 seconds]
shinnya has quit [Ping timeout: 276 seconds]
ski has quit [Ping timeout: 276 seconds]
Ninja123_ has quit [Ping timeout: 276 seconds]
Ninja123_ has joined #ocaml
djellemah_ has joined #ocaml
pierpa` has joined #ocaml
ski__ is now known as ski
pierpa has quit [Ping timeout: 244 seconds]
<M-martinklepsch>
octachron (IRC): yes: system C system System compiler (4.02.3)
<M-martinklepsch>
octachron (IRC): I do have this in ~/.ocamlinit should that be sufficient
<M-martinklepsch>
?
<M-martinklepsch>
or does one .ocamlinit override the other?
Reshi has quit [Ping timeout: 260 seconds]
Reshi has joined #ocaml
<octachron>
M-martinklepsch, yes there is only one .ocamlinit active at a time
<octachron>
i,e, the interpreter only read the closest .ocamlinit
<M-martinklepsch>
octachron (IRC): thanks! that indeed helped! so after starting a toplevel that has #use "topfind";; I still need to do things like #require "core" where do people put these setup things usually?
<octachron>
good question? The root of the project directory maybe?
yegods has quit [Remote host closed the connection]
<M-martinklepsch>
octachron (IRC): but in what kind of file?
govg has quit [Ping timeout: 260 seconds]
yegods has joined #ocaml
dsheets has joined #ocaml
yegods has quit [Remote host closed the connection]
bba has joined #ocaml
govg has joined #ocaml
_y has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
yegods has joined #ocaml
<hannes>
Drup: btw http://lists.ocaml.org is up, https is down... (and http used to redirect to https (maybe with HSTS), at least my firefox tries to contact https all the time)
<Drup>
doh, I have https everywhere ..
<hannes>
(and I recently tried to push people to move lists.ocaml.org to https, seems like I didn't succeed..)
<Drup>
that would be nicer, yes ...
govg has quit [Quit: leaving]
whitequark has joined #ocaml
<whitequark>
anyone knows how the `type nonrec` construct looks like in Typedtree?
<companion_cube>
o/ whitequark
<whitequark>
hi
<companion_cube>
I'd guess it's a flag or something
<Drup>
| Tstr_type of rec_flag * type_declaration list
<Drup>
typedtree.mli:324
<whitequark>
hang on
<whitequark>
oh
<whitequark>
Types.Sig_type
<whitequark>
that's not Typedtree, my bad
<whitequark>
and it already has a rec_flag, which can be Trec_not, Trec_first and Trec_next
<whitequark>
in 4.02, that is
<Drup>
Yes, it shouldn't change much
<whitequark>
okay, but how is `type nonrec` in Parsetree is represented in Types?
<Drup>
I'm .. not sure it is
<whitequark>
does it abuse some scoping mechanism or what
<Drup>
Recursivity for types only change the name resolution, name resolution is done in Types/Typedtree
<Drup>
so, you don't need the information anymore
<whitequark>
>_<
<whitequark>
but I need it in ppx_import
<Drup>
I see
<Drup>
let me think about it
<Drup>
isn't Trec_not enough ?
<whitequark>
Trec_not is what happens for standalone types
<whitequark>
e.g. type a = int is Trec_not
<whitequark>
whereas type a = b and b = a is Trec_first Trec_next
<Drup>
well, "type nonrec a = int" is correct ...
<whitequark>
that breaks recursive data structures
<Drup>
such as ?
<whitequark>
lists?
<whitequark>
ASTs?
<Drup>
but list are rec, are they not ?
<Drup>
they are Tref_first
<Drup>
rec*
<whitequark>
are they?
A1977494 has joined #ocaml
<Drup>
well, they should, it's the first type in a recursive groupe of one type ...
copy` has joined #ocaml
<whitequark>
let me try
ggole has joined #ocaml
<Drup>
looking at typemod, it looks like it should have it, yes
<Drup>
(We need a nice full printers for cm* files)
<whitequark>
hm. what happened to Primitive.description_list ?..
<Drup>
whitequark: it's not "print"
<Drup>
now*
<whitequark>
yeah but that doesn't help me to construct parsetree.
<whitequark>
guess I can rip that off
<Drup>
whitequark: isn't the information you want in Outcometree.out_val_decl ?
<Drup>
it used to return a string list, and the string list seems to now be in oval_prims
<whitequark>
oh
<whitequark>
thanks
ryanartecona has joined #ocaml
<whitequark>
hm, looks like type nonrec results in expanded path
dsheets has quit [Remote host closed the connection]
hcarty has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
seako has quit [Ping timeout: 250 seconds]
seako has joined #ocaml
<maker>
will people have a bad opinion about me if I have non-alphabetically sorted imports?
<maker>
In python this was the case
<maker>
but now I'm too lazy to check .merlin, _oasis, and *.ml files.
<Drup>
nobody is going to care :D
<maker>
very well
<whitequark>
I would silently judge you if their order is different in different files
<flux>
maker, however, many ocaml programmers prefer to avoid 'open' most of the time
<flux>
maker, instead fully qualified references, module aliases and local opens are used
<maker>
flux: because it messes up with the namespace?
<flux>
yep, it becomes difficult to see (without merlin) where a particular symbol comes from
<flux>
in particular in presence of shadowing
<maker>
whitequark: thanks for the honesty, haha
<maker>
flux: I see
<maker>
kewl
<companion_cube>
hu, I don't care about the order of impots, as long as they are not "open"
<flux>
I've also used this approach if I have a largish project having samish dependencies among modules.. put the dependencies to commonModules.ml as module aliases (or includes) and then just open CommonModules into the files using them
<Drup>
Some open are fine
<flux>
but I don't know what people think of that in general.. :)
<companion_cube>
for lack of a better namespacing mechanims
<flux>
sadly people never found common ground on what kind of namespacing should ocaml have
__y has joined #ocaml
__y has quit [Client Quit]
jackweirdy has joined #ocaml
oskarth has quit [Quit: Connection closed for inactivity]
ryanartecona has quit [Quit: ryanartecona]
struktured has joined #ocaml
Reshi has quit [Ping timeout: 246 seconds]
<companion_cube>
hey, Lwt doesn't have an applicative interface ôO
struktured has quit [Ping timeout: 260 seconds]
dsheets has joined #ocaml
rgrinberg has quit [Quit: WeeChat 1.4]
rgrinberg has joined #ocaml
kushal has joined #ocaml
ryanartecona has joined #ocaml
ungz has quit [Quit: Page closed]
sh0t has joined #ocaml
A19774941 has joined #ocaml
malc_ has joined #ocaml
f[x] has quit [Ping timeout: 260 seconds]
A1977494 has quit [Ping timeout: 244 seconds]
BitPuffin has joined #ocaml
snhmib has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
<reynir>
maker: you can write »module Pem_csr = X509.Encoding.Pem.Certificate_signing_request;; Pem_csr.of_pem_cstruct«
<reynir>
That is, give a module a shorter alias instead of open'ing
<companion_cube>
^
<maker>
mm, so that should be the nice way of avoiding opening I guess
<maker>
cool
ryanartecona has quit [Ping timeout: 260 seconds]
<hcarty>
maker: And you can do that locally if you're only using the module in a small scope: let module Pem_csr = X509.Long_module_name in (expression using Pem_csr)
Reshi has joined #ocaml
jeffmo has joined #ocaml
<maker>
hcarty: you can do also local opening annyways right?
ryanartecona has joined #ocaml
<maker>
yes I clearly remember engil doing this
lokien_ has quit [Quit: Connection closed for inactivity]
ryanartecona has left #ocaml [#ocaml]
<companion_cube>
yes, you can
<companion_cube>
let open Foo in
<companion_cube>
also, I find it good style, personally, to provide a `Infix` submodule
<flux>
maker, also Foo.(expr)
<companion_cube>
so you can let open Foo.Infix in .... and only import infix combinators in the scope
<reynir>
let open! Foo in ..., the ! makes it an error if the open shadows something, right? I saw it in this channel some time ago
<Drup>
reynir: yes
<hcarty>
reynir: Other way around - it silences a warning if something is shadowed
<Drup>
oh, right, what hcarty said
sepp2k has joined #ocaml
<rgrinberg>
Is there a good reference somewhere about module initialization side effects (or w/e they're called) and their order. I.e. let () = ...?
<reynir>
Oh
<rgrinberg>
I'm being asked about these and all I have is hearsay..
<companion_cube>
rgrinberg: I'm not sure that's really specified, but from my experience it follows topological order
<companion_cube>
both within a module, and among modules
<reynir>
I think it's just hte order things are linked together
<rgrinberg>
yeah, I thought it was the link order as well
<companion_cube>
yeah
<companion_cube>
but modules are linked in topological order
<companion_cube>
:)
<rgrinberg>
but would like a reference for this point..
<Drup>
companion_cube: modules are linked in the order you give the cmo
<companion_cube>
oh, hmm, you mean it's not mandatory to give them in the good order?
<Drup>
It is, ocaml is going to complain
<companion_cube>
I suppose it's what ocamlbuild does then
<companion_cube>
ah
<companion_cube>
then my point stands
<Drup>
I mean, it's a subset of the topological order, but it's more precise than that
<companion_cube>
"you can give modules in any order , as long as it's a topological order" :p
<companion_cube>
yeah, but I wouldn't rely on the exact link order
<Drup>
companion_cube: you wouldn't, but sometimes it's convenient
<Drup>
(lablgtk.auto-init)
<rgrinberg>
so nobody remembers where they got this information?
<whitequark>
does cohttp actually use ocaml-tls if any?
<whitequark>
that's pretty cool
<hannes>
whitequark: cohttp doesn't know anything about tls
<whitequark>
conduit*
<hannes>
whitequark: but, if you have tls and use conduit (or use mirage-conduit which requires tls), that'll be used... you can also use the openssl bindings with conduit (by installing ssl)
Algebr has joined #ocaml
cdidd has joined #ocaml
<hannes>
unclear to me what the default is -- if you're into developing a mirage unikernel, you won't have much fun with ssl
<maker>
Warning: the tag "pkg_cohttp" is not used in any flag or dependency declaration, so it will have no effect; it may be a typo. Otherwise you can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
<whitequark>
ocamlbuild -use-ocamlfind perchance?
<whitequark>
well, there was something for oasis, I think...
<maker>
I don't even understand what's going on
<gasche>
We really need to special-case this warning for package-like flags, or automagically enable ocamlfind in this case
<gasche>
maker: does building works? this is a warning, not an error
christoph_debian has quit [Ping timeout: 276 seconds]
<maker>
I can reproduce probably if you want to dig down the problem
<maker>
but so far it works \o/
<gasche>
I don't know enough about ocamlbuild to productively suggest how to quiet the warning
<gasche>
so I'll pass
<whitequark>
BuildTools: ocamlbuild should be enough.. hm
<Algebr>
I guess after 5 arguments that a function spills over its arguments to the stack, but what is the max number of args that a function can take anyway, is it like 255?
<Drup>
whitequark: I think there is an issue with dev ppx_import
<whitequark>
"(fonctions pourtant utilisées à tour de bras dans un langage fonctionnel comme OCaml)"
<whitequark>
google translate translates this as "functions used with a vengeance"
BitPuffin has quit [Read error: Connection reset by peer]
<companion_cube>
:D
<companion_cube>
not exactly
BitPuffin has joined #ocaml
<companion_cube>
basically, "used a lot"
<whitequark>
Google is not wrong
<whitequark>
lol system z
<whitequark>
there's also a big push to use swift on system z
<octachron>
Drup, are you implying that parsing "deverminer un glaneur de cellules" takes some time? :p
<whitequark>
"Debugging a cell gleaner" ok
<whitequark>
I don't even have theories
<Drup>
whitequark: garbage collector
<octachron>
whitequark, look at the initials: gc
<whitequark>
...
<companion_cube>
cell gleaner :D
<companion_cube>
oh my
<companion_cube>
is this code in the compiler?
<Drup>
Frankly, "Glaneur de Cellules" is worthy of quebecois translations.
myst|fon has joined #ocaml
leyyin has quit [Ping timeout: 250 seconds]
<adrien>
companion_cube: playing with pipes and sub-process outputs and inputs is always a bit tricky
<adrien>
you're tied to the unix roots
<maker>
So I am using nocrypto now
<adrien>
it's way too easy to forget to close half of the pipe
<maker>
and I want to print a Numeric.Z.t in hex format
<maker>
apparently there's only pp_print and to_cstruct_be, and both are a mess and don't really do what I want
<maker>
is there a way to have a hex-representation of a bignum? If not, adding it would be appreciated?
<gasche>
for stdlib's bigints, I'm pretty sure it's possible
<gasche>
for Numeric.Z.t, it looks like it was not planned for
<gasche>
(the to_string function is too inflexible, it seems)
<maker>
mm but I'm reading a rsa private key, and print out some values
<companion_cube>
adrien: exactly
<companion_cube>
but now I'll remember
<gasche>
another solution would be to have a function from Z.t to (int32 array) or (int64 array), with a specified endianness
<gasche>
so that you could iterate on these digits and print their hexa values (%lx or %Lx)
<maker>
gasche: yep, but that one doesn't seem to be there as well
mistermetaphor has joined #ocaml
<maker>
maybe I can do something with the pp_print function?
<maker>
even if that one is more for debugging
<Algebr>
I am making a class like so: class foo ?arg1 ?arg2 needed = object end and then have a function that goes: let bar (f: foo), but when doing: bar (new foo "Hello") I get a type error because it is complaining about the structucal type not matching, that expected foo but got <arg1: 'a option> and so on
<gasche>
maker: do you have a link to the up-to-date documentation of Numeric.Z? the one I found online doesn't seem to have pp_print, I don't know what the type is
<companion_cube>
I'm writing a build system!
<gasche>
welcome to the club :-)
<zozozo>
companion_cube: your oasis refactoring ?
<companion_cube>
no, it's only a toy actually :)
bba_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<companion_cube>
more on this soon, but I'm not going to compete with the real ones
<gasche>
Algebr: do you have a self-contained piece of code to test and reproduce?
slash^ has quit [Read error: Connection reset by peer]
<maker>
gasche: so there's this module Z in package zarith, and there's this other module Z in Nocrypto.Numeric
<maker>
and they are the same?
<maker>
no, I guess no
<gasche>
so Nocrypto.Numeric.Z re-exports Zarith.Z, plus adds some sexplib conversion functions
<gasche>
the way I guessed this is by looking for the source of Z in nocrypto, not finding out, and then looking at the library dependencies of the project
<maker>
fantastic
jken has joined #ocaml
<flux>
algebr, works on my computer(TM)
octachron has quit [Ping timeout: 244 seconds]
octachron has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
<Algebr>
what the hell, the simple example works but the hard one doesn't will post up real one then
<flux>
I guess if you fully apply the function using labels only, and you have optional arguments, you need to have the additional (ie.) unit argument.. ?
<Algebr>
but I gave the two required labeled args
<flux>
yes, but you put them using labels
<flux>
ie. this fails: bar (new foo ~needed:"hello") but this works: bar (new foo "hello")
<Algebr>
bah, adding a trailing unit works, this still doesn't make sense to me
<flux>
what unit?
<Algebr>
Oh wait, I remember this labels thing, nvm coming back to me
<Algebr>
the compiler type error was useless
BitPuffin has quit [Read error: Connection reset by peer]
<Algebr>
rather it could have been more helpful
<flux>
file a bug.. :)
<Algebr>
yes i should, mantis right, not github
<flux>
"A function taking some optional arguments must also take at least one non-optional argument." says the manual, so I think that's maybe a bit insufficient
rgrinberg has joined #ocaml
<Algebr>
but the labels are non optional
<flux>
indeed.
rgrinberg has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
dsheets has joined #ocaml
ggole has quit []
<hcarty>
Algebr: Yes to mantis. And there is (was?) a "better errors" project which helped with errors like this. I don't know what happened to it though
jken has quit [Quit: Leaving]
dsheets has quit [Remote host closed the connection]
yegods has quit [Remote host closed the connection]
__y is now known as _y
<Algebr>
chenlou (sp?) still working on it
AllanDaemon has joined #ocaml
<AllanDaemon>
hi. I'm struggling with basic stuffs. How do I use a library installed by opam (extlib) in the ocaml repl shell?
<gasche>
you should probably use "utop" instead of "ocaml" as your repl
<zaquest>
does ocaml/opam has something akin to hackage? i mean single source of documentation. ocaml.org has this link `access package docs` which leads to opam package index, but it's not the docs i expected to see :D
<gasche>
not yet
Sim_n has quit [Quit: Leaving]
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<AllanDaemon>
gasche: Oh, I wish i could use utop. But every time I tried to install it (ubuntu, debian, etc), it fails in some part. THe last one was a bug that I don't know if stills unfixed. Now I`m running into different bug at least. So, again, I can't use utop. And I still don't know how to just use a library in the REPL.
<whitequark>
#require "library";;
mistermetaphor has quit [Remote host closed the connection]
mistermetaphor has joined #ocaml
sz0 has joined #ocaml
<AllanDaemon>
Unknown directive `require'.
<AllanDaemon>
the command was `# #require "extlib";;`
<whitequark>
#use "topfind";; before that
<whitequark>
you may want to put #use "topfind";; into ~/.ocamlinit
Anarchos has joined #ocaml
yegods has joined #ocaml
nicholasf has joined #ocaml
<AllanDaemon>
whitequark, thanks. It worked now. For someone who comes from python, where `sudo pip install library; python; import library` the ocaml way is too hard and complicated. Perhaps This is something that can be simplified. Or at least improve the docs, as I trying all day find a doc that answers that and have frustratedly failed
<AllanDaemon>
ops, text cuted
<AllanDaemon>
but thanks whitequark
chenglou_ has joined #ocaml
mattg_ has joined #ocaml
<Algebr>
AllanDaemon: #require "foo" is sort of like import foo
struk|desk has quit [Remote host closed the connection]
<companion_cube>
still needs some polishing, but it parses the _oasis files I tried it on
zaquest has joined #ocaml
cow-orker has joined #ocaml
<Drup>
(23:09:01) companion_cube: it's a bit sad that one dep is not mine though
<companion_cube>
shall I add "sarcasm" to that line?
<Drup>
If you reimplement lwt, I'm going to hit you x)
<companion_cube>
:D
<companion_cube>
I won't
* whitequark
preemptively hits companion_cube
<companion_cube>
ouch
<hcarty1>
companion_cube: Nice - maybe I can use this in oasis2merlin
yegods has joined #ocaml
<Drup>
whitequark :D
<companion_cube>
I think it's better if you can integrate it directly into oasis, as a plugin
<whitequark>
who's going to write the killer app, oasis2devnull
<Drup>
hcarty1: yes, it's a decent way to do it
rwmjones has quit [Ping timeout: 246 seconds]
<hcarty1>
Drup, companion_cube: That's the eventual plan. I need to dig into oasis enough to do that first.
sepp2k has quit [Quit: Leaving.]
rwmjones has joined #ocaml
A1977494 has joined #ocaml
ocaml_n00b has quit [Ping timeout: 250 seconds]
A19774941 has quit [Ping timeout: 260 seconds]
<companion_cube>
hcarty1: I think you can take a look at existing plugins, such as META
<companion_cube>
yours should be pretty close
pierpa` has joined #ocaml
tane has joined #ocaml
A1977494 has quit [Quit: Leaving.]
pierpa has quit [Ping timeout: 252 seconds]
<rgrinberg>
does ocamlgraph come with formatters? what does everyone do to pp graphs?
pierpa` is now known as pierpa
boegel|quassel is now known as boegel
<companion_cube>
erf
<companion_cube>
I think it comes with graphiz printers, at least
nicholasf has quit [Remote host closed the connection]
<hcarty1>
rgrinberg: It does, what companion_cube said
<hcarty1>
companion_cube, Drup: If an all-powerful .project format happens that may be more useful as an oasis plugin. That could take a while though
<companion_cube>
what would this .project file look like?
<rgrinberg>
I know about the graphviz output, I meant something usable from the toplevel though
<hcarty1>
companion_cube: Something shared between merlin and other editor-focused tools. There was noise about it on the ... ocp-index issues like maybe?
<rgrinberg>
it would be nice if this hypothetical formt was json based
<rgrinberg>
so you can exrtact stuff out of it for free with command line tools
<Drup>
rgrinberg: I would still use graphviz ...
<Drup>
Just do a shell call to xdot
<zaquest>
what is the current state of parallel programming in ocaml? from google it seems that it's poorly supported in ocaml, but all discussions are several years old.
tane has quit [Ping timeout: 244 seconds]
<gasche>
zaquest: with the current runtime, you get parallelism by spawning separate processes
<AllanDaemon>
Hi. I'm trying to print out result of a function, which is a Tokens list generated by a lexer. I gave up do print it compiled. I;m using the ocaml REPL for trying to do that. I invoke with `rlwrap ocaml -I _build/ {sintatico,lexico,carregador}.cmo -stdin < auto.carregador.m;`
<Drup>
rgrinberg: is the graph you are trying to print of a specific form ?
<zaquest>
gasche, i see, thank you
<AllanDaemon>
the auto,carregador,ml just calls the function which returns a tokens list. in the REPL they print the result, but then I invoke this way, with the -stdin param, it prints nothing.
<gasche>
AllanDaemon: maybe try with -noprompt instead of -stdin?
<gasche>
not sure why you don't want to go the compiled route; you don't want to write a printing function for your tokens?
<gasche>
(maybe [@@deriving show] would be useful here)
<rgrinberg>
Drup:nah, a simple edge list would suffice it's just for debugging. I can easily write that I guess
<AllanDaemon>
gasche: yeay, the -noprompt worked.
<Drup>
rgrinberg: xdot is stil better :D
tane has joined #ocaml
<gasche>
AllanDaemon: -stdin's documentation specifies that it runs the file "as a script file", which means it silences toplevel output
<rgrinberg>
would be awesome if you could use ocamlgraph within an iocaml notebook and see the xdot rendered inline :P
<rgrinberg>
I can dream
<Drup>
Huum
<gasche>
rgrinberg: just a few pull requests away!
<Drup>
that doesn't seem so hard
<rgrinberg>
gasche: it's probably not practical because I think I'd lose utop's auto completion right?
<AllanDaemon>
No, I don't want to write a printing function to do it. I really believe that this is something the language should provide, I;m from python, just a print solves it all.
cthuluh has quit [Quit: leaving]
<AllanDaemon>
And I don't have idea of how to write it, but i guess it would be a big piece of code, and i am constantly changing my code.
<malc_`>
just that his hunch where things are heading was way off
loli-pyon has quit [Remote host closed the connection]
<Drup>
gasche: for *concurrency* ? No it doesn't
<companion_cube>
well, lwt is ok, but it's not perfect
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<rgrinberg>
Drup: oh I thought you would just write out some svg and then import it in html
<companion_cube>
I'd rather have effects
<Drup>
companion_cube: sure, and in both cases, it's a decent programming language model for concurrency :D
<Drup>
rgrinberg: you need a dot -> svt converter in the browser
<whitequark>
shared memory is not a decent model for concurrency
<Drup>
which is equivalent to what I listed
<Drup>
linked*
<companion_cube>
decent, yeah, but "good", hmm
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<companion_cube>
it's a good implementation of a decent model :p
<gasche>
what are the concurrent communication primitives provided by Lwt?
<gasche>
(besides bind for direct value dependency)
<companion_cube>
join,pick?
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
amnn has joined #ocaml
pyon has joined #ocaml
amnn has quit [Client Quit]
Anarchos has joined #ocaml
<gasche>
I'm skeptical about this solving concurrency in the general case
<gasche>
although it may very well be enough when there is no parallelism involved
AllanDaemon has quit [Ping timeout: 252 seconds]
<companion_cube>
noes, I have a EMFILE error :((
nicholasf has joined #ocaml
lokien_ has quit [Quit: Connection closed for inactivity]
hcarty1 has quit [Ping timeout: 260 seconds]
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
amnn has joined #ocaml
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
badon has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Verlassend]
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<companion_cube>
what's the state of backtraces in lwt, already?
<companion_cube>
I use lwt.ppx, but don't get much
ismaelga has joined #ocaml
leyyin has joined #ocaml
<aantron>
the state of backtraces in lwt is i will look at it eventually, but if someone else wants to contribute information or PRs sooner, i will look as they come in
leyyin has quit [Client Quit]
<Drup>
it's clearly better with the ppx, though.
snhmib has quit [Ping timeout: 260 seconds]
silver has quit [Ping timeout: 246 seconds]
badon has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
madroach has quit [Ping timeout: 244 seconds]
Algebr has quit [Ping timeout: 260 seconds]
madroach has joined #ocaml
mistermetaphor has quit [Remote host closed the connection]
Reshi has joined #ocaml
mistermetaphor has joined #ocaml
mistermetaphor has quit [Ping timeout: 276 seconds]
walter|r has joined #ocaml
pyon has quit [Remote host closed the connection]
al-damiri has quit [Quit: Connection closed for inactivity]