<laserpants>
But then again, I could do without the syntactic sugar.
AlexDenisov has joined #ocaml
<laserpants>
"I could do it without" I mean
kolko has quit [Client Quit]
kolko has joined #ocaml
govg has joined #ocaml
laserpants_ has joined #ocaml
laserpants has quit [Ping timeout: 260 seconds]
\h has joined #ocaml
andreas__ has joined #ocaml
<freyr>
laserpants: AFAIK streams are not part of camlp4 module, they are but a regular module. However, there is camlp4 syntax extension which makes dealing with streams a little bit smoother. You need to find something simular for ppx or use pure streams without syntax sugar.
<Onemorenickname>
I just learnt that ocaml has array literals
<Onemorenickname>
...
Guest93402 has quit [Ping timeout: 260 seconds]
mrnugget has joined #ocaml
<freyr>
laserpants_: well, what kind of domain requires streams usage. I don't know much about them, but it seems they'd been used only for parsers. In this case we have decent parser generators and combinator parsers, so who cares? Why do you want to use them by the way?
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<laserpants_>
freyr: It makes sense for parsing, I think. I am looking at a library called Opal now.
<Drup>
laserpants_: just use menhir
<Drup>
hurg, yeah, don't use opal
<Drup>
When even the stream abstraction is wrong, the rest is not redeemable.
<laserpants_>
Drup: ok. hehe. good to know. I'll check it out.
<freyr>
laserpants_: And for LR menhir is the best choice
<laserpants_>
freyr: Thanks. The parser-combinator approach is what I was looking for.
AlexDenisov has joined #ocaml
silver has joined #ocaml
ygrek has quit [Ping timeout: 255 seconds]
govg has joined #ocaml
<companion_cube>
heh, the example in angstrom is nice
<companion_cube>
I just ported it to CCParse, too see how it would work ^^
eimpec has joined #ocaml
freehck has quit [Ping timeout: 260 seconds]
<eimpec>
Hello there everyone. Did someone could help me regarding js_of_ocaml Websockets library? I'm a novice ocamler. I find it hard to understand how to set up client-side websocket using Websockets. How would one initiate connection?
<eimpec>
Could anyone help me*
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<johnelse>
eimpec: I haven't used it, but it looks like the js_of_ocaml library is just a transparent wrapper around the javascript API; I would try something like
Guest93402 has joined #ocaml
<johnelse>
let socket = new%js WebSockets.webSocket in
mengu_ has quit [Remote host closed the connection]
Guest93402 has quit [Ping timeout: 240 seconds]
freusque has joined #ocaml
<tobast>
Hi
<tobast>
Is there anything in Menhir that allows to expose something in the final .ml{i,} files produced from the mly?
<tobast>
I’m writing a (very) small parser, and I would like to define a custom exception for a parsing error occuring during the processing of some tokens (using Error does not allow me to give the reason)
<tobast>
I’d rather define the exception in the mly if possible, because creating another module just to put "exception … of string" would be a bit overkill…
AlexDenisov has joined #ocaml
<zozozo>
tobast: you can put the exception definition in the preamble
<tobast>
zozozo: the %{ ... %} part?
<zozozo>
yup
<tobast>
But this won’t get exported to the .ml{i,}, I think
<zozozo>
though I'm not sure wether the definitions in it are exported ?
<tobast>
That’s what I did in the first place
<tobast>
but I could not use the exception from outside of the parser, and thus could not catch it.
<zozozo>
hm.. I think you probably have to define it in another module then
<tobast>
That’s a bit sad :c
<zozozo>
tobast: just out of curiosity what language are you writing a parser for ?
<tobast>
zozozo: something really small.
<tobast>
I’m working on a netlist-like (electronic gates, etc.) language, with a hierarchy of « groups »
<tobast>
and defining signatures for each block, to speed up research of a subpart of a circuit (which sounds a lot like subgraph isomorphism…)
<zozozo>
seems fun, ^^
<tobast>
But now I have to test it, and writing electronic circuits AST is not fun :D
<tobast>
So it’s basically something I will use only for testing.
<zozozo>
I understand the feeling, I have my own library of parsers (for languages used in theorem proving) and it's not the funniest to test
freusque has quit [Ping timeout: 258 seconds]
<companion_cube>
it's not that hard to test for success
<companion_cube>
testing for failure is the real pain :/
<tobast>
Yeah.
<tobast>
Particularly when you have to write full ASTs by hand for each test :)
<companion_cube>
(testing for success, for instance, can be : generate random programs, serialize them, then try to parse)
<companion_cube>
(and check it matches)
mengu has joined #ocaml
rpg has joined #ocaml
eimpec has quit [Quit: WeeChat 1.4]
eimpec has joined #ocaml
nomicflux has joined #ocaml
Guest93402 has joined #ocaml
<eimpec>
I have a quick question about js_of_ocaml Websockets again. How should I approach constructing listeners for websocket events? I imagine it could be somethis like this:
<eimpec>
let subscribe url =
<eimpec>
let ws = new%js WebSockets.webSocket url in
<eimpec>
Websockets.onmessage have a type of ('self Js.t, 'self messageEvent Js.t) Dom.event_listener Js.writeonly_prop
<eimpec>
But i kind of lost how to actually bind everything together. Documentation does not seem to be helpful. Maybe there are some resources anyone know?
Guest93402 has quit [Ping timeout: 240 seconds]
malina has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
mengu has quit [Remote host closed the connection]
govg has joined #ocaml
<laserpants_>
Is there no other documentation for angstrom than the GitHub repo? Is it bundled with the package using some doc tool maybe?
mengu has joined #ocaml
rpg has quit [Ping timeout: 240 seconds]
<companion_cube>
you can use ocp-browser
<companion_cube>
but indeed, it should have hosted doc :/
laserpants_ has quit [Ping timeout: 260 seconds]
govg has quit [Ping timeout: 268 seconds]
nomicflux has quit [Quit: nomicflux]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
<freehck>
hello, is it possible to change directory in opam "build" section?
<freehck>
I mean, can I write the 1st command like "cd src" and the 2nd "make"?
<Drup>
freehck: "make -C src"
<freehck>
ah... right.
<freehck>
thx
laserpants has joined #ocaml
<laserpants>
Maybe someone can help me. In parsec, I can get away with something similar to this: http://pastebin.com/zkukeasr
<laserpants>
This doesn't compile. But can you probably see what I am trying to achieve.
<laserpants>
using Angstrom I should add
zpe has quit [Remote host closed the connection]
<companion_cube>
ah, I think it's because there are restrictions on what you can `let rec`
<companion_cube>
usually you can only do it for immediate values (records, constructors, functions)
<companion_cube>
(+ lazy)
<laserpants>
yes I need a different approach I suppose
<companion_cube>
laserpants: consider: `let parens = fix (fun parens -> let expr = parents <|> return Empty in …)`
<companion_cube>
angstrom provides `fix` precisely for that reason, I believe
<laserpants>
I need to wrap my head around that one.. hmm
<companion_cube>
`fix` does the recursion under the hood :-)
<laserpants>
companion_cube: Yes that actually worked, I think. Now I just have to understand what I just wrote.
<laserpants>
thanks.. hehe
<companion_cube>
^^
<laserpants>
everytime I come across this fixpoint thing I feel like I have understood it before, but it takes some time to "grok" it fully
freyr has quit [Remote host closed the connection]
Guest93402 is now known as Algebr
jstolarek has quit [Ping timeout: 264 seconds]
jstolarek has joined #ocaml
<laserpants>
I wrote something like `let (>>=) = List.bind` in my code, but I have a feeling that there is an infix bind operator defined somewhere already. Or is this what people usually do?
<Algebr>
open Lwt.Infix
<laserpants>
Great stuff.
jstolarek has quit [Ping timeout: 264 seconds]
jstolarek has joined #ocaml
<laserpants>
Only that now I think it clashes with Angstrom
<Algebr>
freehck: oh nice, this is a full scheme interpreter?
<freehck>
btw, it seems opam-publish works quite bad with proxy. I haven't mangaged with it.
jstolarek has quit [Ping timeout: 245 seconds]
<freehck>
Algebr: yes, but only R5RS.
<Algebr>
What does that mean practically
<freehck>
No modules support. And some other features we've never used.
jstolarek has joined #ocaml
<freehck>
Algebr: okay, it's just a full scheme interpreter.
<laserpants>
I was using List from Core.Std I think.
foo30303 has quit [Quit: leaving]
<Algebr>
freehck: this is great, I've wanted to study a codebase like this
<laserpants>
It is slightly confusing with all these different "standard" libraries.
<laserpants>
but then, on the other hand, choice is good
<freehck>
laserpants: the worst thing with Core is that a simple program that highly uses it will be about 10MiB. ;)
<freehck>
But's it's so useful and convenient... :P
<laserpants>
I only needed `List.range 0 n` in this case, so I guess I could simply define it myself instead
<companion_cube>
or you can copy it from an existing lib, if it's too annoying to write
<Algebr>
hard to do that with core
<companion_cube>
freehck: oh, the scheme interpreter looks nice
<companion_cube>
I suppose performance is not too great, though? :-)
<n321>
Algebr: but easy with CCList from containers... (if companion_cube does not plug it, i will :)
shinnya has joined #ocaml
<companion_cube>
^^
* companion_cube
quickly checks whether CCList.range is standalone
<n321>
oh - ok i did not actually check that...
larhat has quit [Quit: Leaving.]
<Drup>
worst case, it needs 2 modules, which will .. not blow your executable size
<companion_cube>
with containers, indeed
<companion_cube>
(although `open Containers` is more costly in link overhead)
<Drup>
companion_cube: it's not using module aliases ?
<companion_cube>
not only, there are things such as `module List = struct include List include CCList end`
<companion_cube>
which I don't believe is a mere module alias
<Drup>
hum, why didn't you put the include in CCList directly, and use a real module alias ?
<companion_cube>
because CCList is an extension of List, not a replacement
<companion_cube>
(I could have CCList_full or sth like that though)
dhil has quit [Ping timeout: 268 seconds]
laserpants has quit [Ping timeout: 260 seconds]
regnat has quit [Read error: Connection reset by peer]
freusque has quit [Quit: WeeChat 1.6]
eimpec has quit [Ping timeout: 240 seconds]
freusque has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Exagone313 has joined #ocaml
ygrek has joined #ocaml
mengu has quit [Remote host closed the connection]
jnavila has quit [Ping timeout: 260 seconds]
slash^ has joined #ocaml
ryanartecona has joined #ocaml
Flerex has joined #ocaml
dhil has joined #ocaml
laserpants has joined #ocaml
freusque has quit [Quit: WeeChat 1.6]
freusque has joined #ocaml
eimpec has joined #ocaml
freusque has quit [Client Quit]
govg has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
<Onemorenickname>
hi
<Onemorenickname>
i was wondering if there was something with merlin allowing me to interpret files opened in emacs
shinnya has quit [Ping timeout: 260 seconds]
<tobast>
Onemorenickname: interpret? It does not look like anything merlin does
<Onemorenickname>
tobast, i mean, like a toplevel
<Drup>
Onemorenickname: tuareg mode does that
<tobast>
Merlin is basically a fuzzy parser and typer, plus a few lice features
<tobast>
it won’t act as a toplevel
<tobast>
but I’m sure emacs does.
<tobast>
(I use vim, though)
<Onemorenickname>
Drup, oh, tuareg mode, right
<Onemorenickname>
I'm getting a 'File "/home/test/.ocamlinit", line 8, characters 46-65 |Error: Unbound constructor OCAML_TOPLEVEL_PATH ' and google does not find anything .-.
<Onemorenickname>
now i got to make ocaml-toplevel aware of my "_build" folder, like merlin
dhil has quit [Ping timeout: 240 seconds]
andreas__ has quit [Quit: Connection closed for inactivity]
eimpec has quit [Quit: WeeChat 1.4]
eimpec has joined #ocaml
jao has joined #ocaml
larhat has joined #ocaml
Denommus has joined #ocaml
<Onemorenickname>
hm
<Onemorenickname>
I'm looking into utop
<Onemorenickname>
And I don't find anything like "_tags" or ".merlin"
Flerex has quit [Read error: Connection reset by peer]
<Onemorenickname>
we can't load a file from a complex project with utop ?
<gjaldon__>
Onemorenickname: you can do `#load “myproject.cma”` I think
<gjaldon__>
so you’ll need to compile the project first
<Onemorenickname>
gjaldon__, yep, but for a complex project, you can't load every .cma by yourself
<Onemorenickname>
that's the point of "_tags" for ocamlbuild or ".merlin" for merlin
rpg_ has quit [Ping timeout: 252 seconds]
<Algebr>
there's a way, i forgot
<Onemorenickname>
ha ha
<tane>
Onemorenickname, see .ocamlinit file
<tane>
or #load_rec directive
jao has quit [Remote host closed the connection]
<Onemorenickname>
tane, looking into that
saidinwot1 has quit [Ping timeout: 264 seconds]
ygrek has joined #ocaml
jao has joined #ocaml
<Onemorenickname>
well well well, it can not find any file
saidinwot1 has joined #ocaml
<tane>
Onemorenickname, what files?
<Onemorenickname>
the "_build" files
<Drup>
Onemorenickname: the ocaml/utop commands accepts the same arguments as the compiler, give him that
kakadu has quit [Quit: Konversation terminated!]
rpg has joined #ocaml
rpg has quit [Ping timeout: 252 seconds]
<Onemorenickname>
Drup, oh, by the compiler, you didnot mean ocamlbuild, but ocamlc
<Onemorenickname>
hm
rpg has joined #ocaml
<Onemorenickname>
is there a utop configuration file ?
<Onemorenickname>
i could make utop work, but i had to #directory and #require many things
<Onemorenickname>
and it'd be quite complicated if i had to do this everytime
<tane>
Onemorenickname, that's what the .ocamlinit file is for
<Onemorenickname>
oh
<tane>
just put it in there
<Onemorenickname>
i thought it was a global configuration
<tane>
you can have a per-directory .ocamlinit
<Onemorenickname>
so i can just put commands in there, and they'll be loaded automatically
<Onemorenickname>
nice
<Onemorenickname>
perfect :)
<Onemorenickname>
Now we are talking ! :D
<tane>
but as I mentioned before, you have to firefox the utop in emacs, while emacs is in the right working directory
<tane>
firefox = fire up, damn
<tane>
:d
jao has quit [Remote host closed the connection]
<Onemorenickname>
tane, i think i'll just utop out of emacs :D
malina has quit [Ping timeout: 245 seconds]
jao has joined #ocaml
rpg has quit [Ping timeout: 260 seconds]
jnavila has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
<okeuday_bak>
If I have an int constant larger than 32bit ocaml can handle (like 4294967295) the source code will error on the 32 bit system during compilation, right?
<_y>
yes
<okeuday_bak>
k, thanks
<_y>
# 5_000_000_000
<_y>
Error: Integer literal exceeds the range of representable integers of type int
<okeuday_bak>
k, cool
<_y>
for this kind of questions, you can try it by yourself in the interpreter
<okeuday_bak>
yes, I just don't have a 32 bit machine handy right now
<_y>
by the way, “native” ocaml integers (type int) are 31 or 63 bits depending on your architecture, not 32 or 64
<okeuday_bak>
I will use one for testing later to check to see if I missed something I think
<okeuday_bak>
yeah, attempting to avoid problems due to that
<_y>
you can use Int64 to compute with integers that are always 64 bits
<okeuday_bak>
sure, its just that everything in ocaml uses int, so that is the normal data type to use
<okeuday_bak>
and the rest are slower, etc.
djellemah_ has joined #ocaml
freusque has joined #ocaml
<freechips>
why 31 bits?
TheLemonMan has joined #ocaml
<_y>
one bit is used by the ocaml runtime to distinguish between a pointer and an immediate value
<_y>
that is required for the garbage collector to traverse the accessible values
djellemah_ has quit [Quit: Leaving]
djellemah_ has joined #ocaml
kakadu has joined #ocaml
malc_ has quit [Remote host closed the connection]
vramana has quit [Ping timeout: 268 seconds]
jnavila has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
slash^ has quit [Read error: Connection reset by peer]
Denommus has quit [Ping timeout: 240 seconds]
larhat1 has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
troydm has joined #ocaml
<okeuday_bak>
It appears that https://try.ocamlpro.com is using a 32bit ocaml, however, max_int = 2147483647, if ints are 31 bits it should be 1073741823, right? is this some special 32 bit mode that is different?
<Drup>
rules are a bit different in javascript :)
<Drup>
(in particular for wordsize)
<okeuday_bak>
oh, they converted it to javascript
<Drup>
sure, it's running ocaml in your browser, no server is involved
<okeuday_bak>
k, cool
tizoc has quit [Quit: Coyote finally caught me]
zpe has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #ocaml
TheLemon1an has joined #ocaml
TheLemon1an has quit [Client Quit]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
freusque has quit [Quit: WeeChat 1.4]
freusque has joined #ocaml
freusque has quit [Client Quit]
mengu has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
jnavila has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #ocaml
freusque has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 256 seconds]
larhat1 has quit [Quit: Leaving.]
ryanartecona has quit [Quit: ryanartecona]
kakadu has quit [Remote host closed the connection]
leah2 has quit [Ping timeout: 276 seconds]
jnavila has quit [Remote host closed the connection]
noddy has quit [Ping timeout: 268 seconds]
rpg_ has joined #ocaml
freusque has quit [Ping timeout: 258 seconds]
djellemah_ has quit [Ping timeout: 245 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
tizoc has joined #ocaml
Simn has quit [Quit: Leaving]
freusque has joined #ocaml
eimpec has quit [Quit: WeeChat 1.4]
tane has quit [Quit: Leaving]
rpg_ has quit [Ping timeout: 240 seconds]
noddy has joined #ocaml
sz0 has joined #ocaml
ryanartecona has joined #ocaml
leah2 has joined #ocaml
<haesbaert>
anybody know the easiest way to disable classic-display in topkg ?
malina has joined #ocaml
fraggle-boate has quit [Ping timeout: 252 seconds]