<monstasat>
Hi! Can anybody advice the best way to dispatch an event in js of ocaml? As mentioned in MDN, 'dispatchEvent' method is defined in 'EventTarget' class (https://developer.mozilla.org/ru/docs/Web/API/EventTarget/dispatchEvent), but I failed to find this method in js of ocaml. Do I need to use Js.Unsafe for this purpose or there is a better way?
snhmib has joined #ocaml
argent_smith has joined #ocaml
zpe has joined #ocaml
demonimin has joined #ocaml
mk9 has joined #ocaml
<chindy>
I wonder does merlin/tuareg on emacs have a "jump to definiton" key?
<LACampbell>
christ the tooling is still awful. the function signature of things in utop are different from the function signatures of the things corebuild finds. I always come back to ocaml every year or so because the language is great, then always give it up because it's just such an uphill battle to get anything done.
<reynir>
chindy: ^
<chindy>
reynir: ahh yes, thanks
<chindy>
LACampbell: I have to admit that VScode works very well if you dont want to get into emacs (which i can understand)
<chindy>
LACampbell: there is a plugin that has reason in the name but is developed for both reason and ocaml
<TheLemonMan>
LACampbell, at least now there's a single good build system :)
<LACampbell>
chindy: setting up the IDE was actually the easy part this year
<LACampbell>
it's the same old opam dance I always have to do
<LACampbell>
TheLemonMan: what is it?
jimmyrcom has quit [Ping timeout: 256 seconds]
<TheLemonMan>
LACampbell, dune (was jbuilder)
<LACampbell>
well, we'll see what dune things the function signature of Deque.create is. if it can agree with utop, I'll be on my way
<chindy>
LACampbell: really? I mean i know what you mean... but I find opam to be the supreme package manager around... Compared to stack/cabal/pip/npm.... all the others granted the bar is not high, because I think they all suck.... but opam imo really is the best
<chindy>
and dont let me get started on the hell that is the entire java environment/infrastructure
<LACampbell>
right but the difference with Java is that there's a million results on google when you get stuck
<TheLemonMan>
Drup, for me merlin flat-out segfaults when I use it on the compiler files :\
pistachio2 has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 is now known as Guest77240
infinity0 has joined #ocaml
Guest77240 has quit [Ping timeout: 260 seconds]
dhil has joined #ocaml
ziyourenxiang has quit [Ping timeout: 252 seconds]
ski has quit [Ping timeout: 240 seconds]
ziyourenxiang has joined #ocaml
yaewa has joined #ocaml
moei has quit [Ping timeout: 245 seconds]
kakadu has joined #ocaml
mfp has joined #ocaml
snhmib has quit [Ping timeout: 256 seconds]
yaewa has quit [Quit: Leaving...]
moei has joined #ocaml
ziyourenxiang has quit [Ping timeout: 256 seconds]
LACampbell has quit [Ping timeout: 265 seconds]
snhmib has joined #ocaml
ziyourenxiang has joined #ocaml
ski has joined #ocaml
FreeBirdLjj has joined #ocaml
LACampbell has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
ziyourenxiang has quit [Ping timeout: 245 seconds]
ziyourenxiang has joined #ocaml
LACampbell has quit [Ping timeout: 268 seconds]
shinnya has joined #ocaml
ziyourenxiang has quit [Ping timeout: 260 seconds]
emias has quit [Quit: WeeChat 2.0]
mk9 has quit [Ping timeout: 265 seconds]
snhmib has quit [Ping timeout: 256 seconds]
zolk3ri has joined #ocaml
johnelse has quit [Ping timeout: 276 seconds]
ziyourenxiang has joined #ocaml
emias has joined #ocaml
ruffy__ has quit [Ping timeout: 276 seconds]
emias has quit [Quit: WeeChat 2.0]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Haudegen has quit [Remote host closed the connection]
emias has joined #ocaml
emias has quit [Client Quit]
emias has joined #ocaml
emias has quit [Client Quit]
maattdd_ has joined #ocaml
emias has joined #ocaml
dhil has quit [Ping timeout: 276 seconds]
tarptaeya has joined #ocaml
mk9 has joined #ocaml
tarptaeya_ has joined #ocaml
maattdd_ has quit [Ping timeout: 255 seconds]
tarptaeya has quit [Ping timeout: 268 seconds]
MercurialAlchemi has quit [Ping timeout: 265 seconds]
spew has joined #ocaml
MercurialAlchemi has joined #ocaml
_andre has joined #ocaml
spew has left #ocaml [#ocaml]
mbuf has quit [Quit: Leaving]
tarptaeya_ is now known as tarptaeya
_andre has quit [Quit: leaving]
butterthebuddha has quit [Max SendQ exceeded]
shinnya has quit [Ping timeout: 260 seconds]
butterthebuddha has joined #ocaml
snhmib has joined #ocaml
_andre has joined #ocaml
mk9 has quit [Ping timeout: 240 seconds]
mk9 has joined #ocaml
johnelse has joined #ocaml
haesbaert has quit [Ping timeout: 260 seconds]
haesbaer1 has joined #ocaml
zolk3ri has quit [Ping timeout: 248 seconds]
zolk3ri has joined #ocaml
al-damiri has joined #ocaml
gtrak has joined #ocaml
freusque has quit [Quit: WeeChat 2.0]
dhil has joined #ocaml
maattdd_ has joined #ocaml
ziyourenxiang has quit [Ping timeout: 265 seconds]
mk9 has quit [Quit: mk9]
gtrak_1 has joined #ocaml
Haudegen has joined #ocaml
_xvilka_ has quit [Ping timeout: 240 seconds]
gtrak has quit [Ping timeout: 276 seconds]
mk9 has joined #ocaml
gtrak_1 has quit [Ping timeout: 255 seconds]
gtrak_1 has joined #ocaml
sh0t has joined #ocaml
pierpa has joined #ocaml
snhmib has quit [Ping timeout: 256 seconds]
johnelse_ has joined #ocaml
johnelse has quit [Ping timeout: 240 seconds]
zolk3ri has quit [Ping timeout: 252 seconds]
zolk3ri has joined #ocaml
blaah has joined #ocaml
kuwze has quit [Ping timeout: 260 seconds]
MercurialAlchemi has quit [Ping timeout: 276 seconds]
ruffy__ has joined #ocaml
snhmib has joined #ocaml
<blaah>
hello folks. i'm trying to call a simple C function, built as a shared library, from OCaml following Chapter 19 of the manual, but no luck so far. are there other examples i could take a look at? struggling to find any
Haudegen has quit [Remote host closed the connection]
<octachron>
blaah, just to be sure, are you aware of the existence of ctypes?
<blaah>
octachron: yes, but hoping to do this without installing ctypes, since it's supposed to be simple
<blaah>
orbifx: ok, so i do have a .ml file with an external line and a .c file with my stubs. i did 'ocamlc -c' for both, no problems so far.
ziyourenxiang has joined #ocaml
monad_cat has quit [Ping timeout: 256 seconds]
mrallen1 has quit [Read error: Connection reset by peer]
rfv has quit [Read error: Connection reset by peer]
mrallen1 has joined #ocaml
rfv has joined #ocaml
Haudegen has joined #ocaml
<remix2000>
How to cross- compile OCaml code as native Raspberry Pi (armv6) executable?
monad_cat has joined #ocaml
monstasat has quit [Remote host closed the connection]
ruffy__ has quit [Ping timeout: 276 seconds]
tane has joined #ocaml
<companion_cube>
not sure you can cross compile right now, you can try to compile on the raspi
<companion_cube>
(not sure if there's a better option)
maattdd_ has quit [Ping timeout: 260 seconds]
<remix2000>
Ok. :) Raspi is too weak, so I'll just run bytecode.
maattdd_ has joined #ocaml
snhmib has quit [Ping timeout: 276 seconds]
<orbifx>
remix2000: you must have a large codebase for RPi to not manage
gtrak_1 has quit [Ping timeout: 276 seconds]
snhmib has joined #ocaml
<remix2000>
orbifx: to not manage what exactly? I don't understand...
<companion_cube>
orbifx: depends, if you use core it can take a while to compile ;)
<orbifx>
lol
<orbifx>
remix2000: to build natively on rpi
<remix2000>
orbifx: have I mentioned that it's the first model of rpi?
<remix2000>
It is slow even when you try to install updates. That's probably why I misunderstood. :P
johnelse_ is now known as johnel_away
johnel_away is now known as johnelse_
gtrak_1 has joined #ocaml
<ELLIOTTCABLE>
hi, loves
<ELLIOTTCABLE>
I'm new, forgive a possibly-dumb-question, but:
<ELLIOTTCABLE>
what's an idiomatic way to match on *two* optional values, in a boolean-OR fashion?
<ELLIOTTCABLE>
i.e. I have a `lexeme ?skip ?drop …` function;
zpe has quit [Remote host closed the connection]
<ELLIOTTCABLE>
and I want to do one thing in the case where neither is provided, but another thing — with default values — in the case where either/both *are* provided.
<ELLIOTTCABLE>
I can nest two matches (to set defaults) inside a third match (to test for either), but that sounds horrid — is there a prettier way? (=
<Drup>
match skip, drop with Some _, None -> ... | ...
zpe has joined #ocaml
gtrak_1 has quit [Ping timeout: 276 seconds]
argent_smith1 has joined #ocaml
argent_smith2 has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
argent_smith3 has joined #ocaml
argent_smith has quit [Ping timeout: 260 seconds]
argent_smith2 has quit [Ping timeout: 240 seconds]
argent_smith1 has quit [Ping timeout: 265 seconds]
<ELLIOTTCABLE>
Drup: well, here's my start, but it's not compiling for an obvious reason:
<ELLIOTTCABLE>
since the (Some …, None) cases don't assign a value to the same variable name — I'm not sure how to implement the “default-to-0” behaviour idiomatically?
johnelse_ is now known as johnelse
<Drup>
ELLIOTTCABLE: if the only thing that you want is a default value, just do `lexeme ?(skip=0) ?(drop=0)`
<ELLIOTTCABLE>
that's actually how it started out!
<ELLIOTTCABLE>
I was just idly trying to optimise / improve it, to learn more OCaml.
mk9 has quit [Ping timeout: 265 seconds]
<ELLIOTTCABLE>
specifically, if both are not given, I can use a faster non-substring version of the target function
<ELLIOTTCABLE>
Sedlexing.Utf8.lexeme vs Sedlexing.Utf8.sub_lexeme
<Drup>
pretty sure lexer is "sub_lexeme 0 length"
<Drup>
lexeme*
* ELLIOTTCABLE
nods
<Drup>
so, that optimization is ... a bit needless, let's say
<ELLIOTTCABLE>
I'll revert back to that — but maybe, for future reference, how *would* I alternate on a pair of options like this?
<ELLIOTTCABLE>
maybe there's a method on Option. I can use; I'll go look
mk9 has joined #ocaml
mk9 has quit [Remote host closed the connection]
mk9 has joined #ocaml
Haudegen has quit [Remote host closed the connection]
snhmib has quit [Ping timeout: 256 seconds]
mk9 has quit [Ping timeout: 265 seconds]
gtrak_1 has joined #ocaml
gtrak_1 has quit [Ping timeout: 256 seconds]
gtrak_1 has joined #ocaml
ziyourenxiang has quit [Ping timeout: 265 seconds]
maattdd_ has quit [Ping timeout: 256 seconds]
kuwze has joined #ocaml
maattdd_ has joined #ocaml
jao has joined #ocaml
johnelse has quit [Ping timeout: 248 seconds]
Guest90464 has joined #ocaml
<remix2000>
Which SSH server library should I use?
mbuf has quit [Quit: Leaving]
jrslepak has joined #ocaml
maattdd_ has quit [Ping timeout: 265 seconds]
<reynir>
remix2000: there's a rudimentary libssh bindings that might be good enough for you....
chat_ has quit [Ping timeout: 265 seconds]
<kakadu>
OCaml 4.06 gives me warning 52 and refers to manual section 8.5 which is wrong. It seems that it should be 9.5. Is it a bug?
blaah has quit [Quit: Connection closed for inactivity]
chat__ has joined #ocaml
<octachron>
kakadu, yep, I forget to update the section numbering when the new manual chapter on polymorphism was added
<octachron>
this is fixed (in trunk?) and measures have been taken to ensure that this does not happen again
jrslepak has quit [Quit: Lost terminal]
<Drup>
"measures have been take" -> Did you chop off one finger of the guy in charge of updating the section numbers ? :D
dhil has quit [Ping timeout: 256 seconds]
Guest90464 is now known as Haudegen
<reynir>
ouch
kakadu has quit [Quit: Konversation terminated!]
<octachron>
Drup, in a moment of mercifulness, the sentence was commuted to the writing a new manual consistency test
govg has quit [Ping timeout: 252 seconds]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
jimmyrcom has joined #ocaml
kakadu has joined #ocaml
zpe has quit [Remote host closed the connection]
vista has joined #ocaml
<vista>
Total ocaml layman here, trying to install some packages from OPAM required for building a package -- I have this weird problem where after installing packages from OPAM, ocamlfind does not see the libs, however, when I do eval `opam config env`, ocamlfind no longer sees the libs installed by my system's package manager. Any idea what could be going on here?
snhmib has joined #ocaml
<companion_cube>
well it's not really expected that you mix system-installed libs and opam libs
<companion_cube>
I think most people just use opam-installed libs
<vista>
I'll try installing everything from OPAM, then
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
ruffy__ has joined #ocaml
LACampbell has joined #ocaml
tarptaeya has quit [Quit: Leaving]
zpe has joined #ocaml
chat__ has quit [Ping timeout: 240 seconds]
<vista>
just wondering, is OCaml 4.X not backwards-compatible? I have a package here written for OCaml 3.11, but it fails to build, and all dependencies have been met.
<Fardale>
with 4.06.x String are not mutable, that one breaking change I know of
ruffy__ has quit [Ping timeout: 245 seconds]
jnavila has joined #ocaml
<octachron>
4.X should be in large part backward compatible, nevertheless there are some pathological cases where backward-compatibility was dropped
chat__ has joined #ocaml
maattdd_ has joined #ocaml
<vista>
well, bloody hell, even the "recommended" (as in, mentioned in the README) OCaml version does not compile this. As far as I can see, there was no change to that line of the file since the repository was first version tracked with git
maattdd_ has quit [Ping timeout: 256 seconds]
<Armael>
out of curiosity, what is it that you are trying to compile?
<vista>
virt-top, it's top-like for libvirt VMs
<vista>
judging from the fact that the 'libvirt' dependency does not build cleanly from OPAM, I would've said that it's not maintained, yet there are commits in the repo from 2017 november
<justin_smith>
/ b 2
<Drup>
vista: I don't see any virt-top package in opam
<vista>
oh, it uses the libvirt package from OPAM
<vista>
it itself is not on OPAM
<vista>
even though I couldn't solve the problem in the end, thanks for the help!
Haudegen has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
pierpa has joined #ocaml
smondet[m] has quit [Ping timeout: 256 seconds]
smondet[m] has joined #ocaml
zpe has joined #ocaml
butterthebuddha has quit [Max SendQ exceeded]
butterthebuddha has joined #ocaml
<LACampbell>
ocaml seems to break backwards compatibility all the time. it's not a serious concern for the people who make it
<LACampbell>
vista: ^
sonologico has quit [Ping timeout: 256 seconds]
sonologico has joined #ocaml
<companion_cube>
are you kidding?
<companion_cube>
the only breakage in the last 15 years is -safe-string
<companion_cube>
and it's been done over several years, with a clear migration path
gtrak_1 has quit [Ping timeout: 268 seconds]
Haudegen has joined #ocaml
nore_ has joined #ocaml
nore_ has quit [Client Quit]
Haudegen has quit [Ping timeout: 256 seconds]
gentauro has quit [Ping timeout: 248 seconds]
jrslepak has joined #ocaml
Haudegen has joined #ocaml
<dh_work>
<companion_cube> well it's not really expected that you mix system-installed libs and opam libs
<dh_work>
is there any reason that shouldn't be expected to work, other than it takes effort?
<dh_work>
(which I don't blame anyone for not wanting to put in, don't get me wrong)
gentauro has joined #ocaml
<dh_work>
(or wait, does opam compile packages or install precompiled packages?)
_andre has quit [Quit: leaving]
<companion_cube>
it compiles packages
<companion_cube>
the issue is that you're going to have 2 distinct installations of ocamlfind
<companion_cube>
and they're not going to agree on what (or where) is installed
jrslepak has quit [Quit: leaving]
gtrak_1 has joined #ocaml
tane has quit [Quit: Leaving]
jnavila has quit [Ping timeout: 240 seconds]
zpe has quit [Remote host closed the connection]
AltGr has left #ocaml [#ocaml]
andreas_ has quit [Quit: Connection closed for inactivity]
gtrak_1 has quit [Ping timeout: 256 seconds]
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
sh0t has quit [Ping timeout: 276 seconds]
Haudegen has quit [Remote host closed the connection]
<ELLIOTTCABLE>
Okay, I'm trying to build my first parser using menhir/sedlex, and I've managed to back myself into an infinite-loop. Anybody with some experience with these tools want to take a quick look? :x
<dh_work>
i don't know anything about sedlex but I can probably cope with menhir
<ELLIOTTCABLE>
dh_work: *nods*
<ELLIOTTCABLE>
I doubt it's all that different from ocamllex or ulex
<ELLIOTTCABLE>
just a ppx extension to do the same thing as ulex, as I understand it
cbot has joined #ocaml
<dh_work>
that question suggests you're going about the problem wrong, though
<ELLIOTTCABLE>
I almost certainly am! I have no idea what i'm doing ;_;
<dh_work>
:-/
<dh_work>
scheme should be real easy to parse
<dh_work>
that's the whole point of s-expressions.
<ELLIOTTCABLE>
well mind you I'm trying to go a little beyond simply "read s-expr"
<dh_work>
but the last time i looked at scheme was r4rs days, if not r3rs
<ELLIOTTCABLE>
the parser's output format is actually literally Sexp.t; but I'm trying to do a bunch of verification with the parser, basically
<ELLIOTTCABLE>
i.e. I'm trying to encode the format syntax from the specification
gtrak_1 has joined #ocaml
<dh_work>
so my strong recommendation, having written a *lot* of parsers and frontends, is:
<ELLIOTTCABLE>
(again, just to learn — I could definitely abandon all of this and move forward with Sexplib.read_sexps or similar
<dh_work>
do not put validation work in the parser.
<dh_work>
build a parse tree, then grind it.
<dh_work>
make the parse tree match the concrete syntax closely enough that the parser requires no particular brains in its parser actions.
<ELLIOTTCABLE>
actually rn it's the lexer doing ‘the work’ of figuring out where an identifier ends
<dh_work>
that's what should be doing the work (otherwise, you can use fun x -> x as your lexer)
<dh_work>
(practically)
<ELLIOTTCABLE>
oh, so I'm not totally off, then?
<dh_work>
but my guess is that what the spec is trying to say is that "abcabc" can only be interpreted as one identifier and not arbitrarily divided into two.
<ELLIOTTCABLE>
Specifically, the line “ Tokens which require implicit termination (identifiers, numbers, characters, and dot) may be terminated by any <delimiter>, but not necessarily by anything else.”
<dh_work>
the lexer should convert a stream of characters into a stream of tokens, where tokens are things like IDENTIFIER, COLON, COMMA
<ELLIOTTCABLE>
which to me sounds like it means “You shouldn't lex an IDENTIFIER unless it's immediately followed by a delimiter”
<ELLIOTTCABLE>
hence me trying to encode that at the lexer-level
<dh_work>
basically the lexer should do the work of combining nearby characters into tokens, where tokens are the base units of the real grammar
<ELLIOTTCABLE>
y'dig? :x
<dh_work>
right, but what are the characters?
<dh_work>
if for the sake of argument we suppose that the only input characters are 0, a, (, ), and ,
<dh_work>
and space
<dh_work>
then I'd expect it considers ( ) , to be delimiters
<ELLIOTTCABLE>
I *think* this stuff about implicit termination of identifiers is because of special characters — *, &, etc — in identifiers
<ELLIOTTCABLE>
I can't quite wrap my head around why that requirement is mentioned in prose (shouldn't that be encoded in the EBNF, somehow?)
<ELLIOTTCABLE>
but I thought I should respect it since it said it ¯\_(ツ)_/¯
<ELLIOTTCABLE>
and yah delimiters are:
troydm has joined #ocaml
<dh_work>
well, the basic thing about implicit termination of identifiers is that identifiers don't have a specific endpoint
<ELLIOTTCABLE>
a bit foreshortened, bu that's basically the regexes in my lexer (left out the obvious ones)
<ELLIOTTCABLE>
hm
<ELLIOTTCABLE>
I *think* the prose description is because they didn't want to express what *could* be in an identifier, instead what *must*, and what *must not* be
<ELLIOTTCABLE>
is what I'm realising
<ELLIOTTCABLE>
the EBNF breaks down what *must* be supported; but the “doesn't necessarily end, until one of these explicit delimiters” leaves room for other characters to be included in the identifier, I guess?
<ELLIOTTCABLE>
that's really confusing.
<ELLIOTTCABLE>
anyway probably not the channel for this. thanks for talking through it with me, dh_work <3
kakadu has quit [Remote host closed the connection]