<freehck>
cheater: ~arg means that arg is a mandatory named argument, ?arg means that arg is an optional named argument. If there's no specified default value for ?arg its value will be 'a option, and default will be None.
<freehck>
octachron: by the way, I haven't seen examples of using GADT for real tasks. Do you know projects that are good for understanding where to use GADT?
<freehck>
well the same thing with first class modules
FreeBirdLjj has quit [Remote host closed the connection]
dhil has joined #ocaml
Simn has joined #ocaml
FreeBirdLjj has joined #ocaml
ziyourenxiang has quit [Quit: Leaving]
AltGr has joined #ocaml
dhil has quit [Ping timeout: 252 seconds]
jnavila has quit [Quit: It was time]
Sim_n has joined #ocaml
frefity has quit [Ping timeout: 260 seconds]
Simn has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
TarVanimelde has quit [Read error: Connection reset by peer]
nahra has joined #ocaml
mengu has joined #ocaml
mengu has quit [Ping timeout: 255 seconds]
larhat has joined #ocaml
frefity has joined #ocaml
sz0 has joined #ocaml
zpe has joined #ocaml
ia0 has quit [Quit: reboot]
jnavila has quit [Quit: It was time]
ia0 has joined #ocaml
jnavila has joined #ocaml
mfp has joined #ocaml
<n4323>
hi, is it possible to build a custom toplevel that includes a native code ocaml package?
<n4323>
i need interactive speed...
<companion_cube>
hum, I'm not sure :3
<n4323>
in the docs it explains how to include object files but not ocaml packages - i assume it can't be done
FreeBirdLjj has quit [Remote host closed the connection]
mrnugget has joined #ocaml
pierpa has joined #ocaml
<Drup>
n4323: there is something called "topnat" (or nattop ?) in the compiler sources. iirc, it's not perfectly stable, so it's not installed by default
<n4323>
i have heard rumors about this as a future enhancement but i have never seen it working currently. i would not know where to start trying to get it to work...
<freehck>
octachron, companion_cube: thx.
<Drup>
the code for furl (and the associated blog post) should be quite readable too
<Drup>
(on the topic of GADTs)
<companion_cube>
ah yes, I had a blog post on that too
<companion_cube>
anyway
<Drup>
companion_cube: we should tag all the gadt-heavy library with the "gadt" tag on github :p
<companion_cube>
:D
<companion_cube>
that's a nice idea
<companion_cube>
ah nice, github suggests topics now
<Drup>
I already did it for tyre and furl :p
<companion_cube>
same for olinq
<companion_cube>
✔
iwan_ has joined #ocaml
<Drup>
octachron: you should tag your rational-in-types shenanigans :D
<iwan_>
With the Ocaml Format module, is there a way of tracking if a line break happened?
<iwan_>
example: if a line break occured, insert a trailing sepator
silver has joined #ocaml
<Drup>
where should the trailing separator go ?
<octachron>
Drup, with a "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn" tag?
<iwan_>
`let x = (1, 2, 3, 4,)`
<iwan_>
but every item of the tuple is on a separate line
<flux>
drup, in fact, opam should support tags ;-)
<Drup>
iwan_: that's what boxes are for
<Drup>
flux: opam does support tags
<flux>
and a warning at install time: "Beware! You are about to install a library with GADT-heavy interface! Are you sure? [y/N]"
<flux>
"May cause permanent changes in your brain!"
<companion_cube>
github should support opam-provided tags
<flux>
drup, oh, how do I see them? I just did opam show containers and didn't see any tags, before saying the idea ;)
<companion_cube>
opam info containers shows them
<flux>
oh, it does :-), I just missed it in "show"
<flux>
well great, so the pipeline is ready!
<iwan_>
Drup: with a hvbox, I probably can't insert characters only if the hvbox determined it needs to break the line?
<Drup>
I don't understand what you mean
<mrnugget>
Total OCaml beginner here. I'm kinda struggling with the section about polymorphic variants in Real World OCaml (https://realworldocaml.org/v1/en/html/variants.html). Can anyone recommend other resources on this particular topic?
<companion_cube>
iwan_: I don't think so
<flux>
I think iwan_ 's use case is to add ie … when a line is broken to continue on the next line
<cheater>
can i paste in 5 lines from the manual here? there's something I don't understand
<freehck>
toolslive: if you use "with fields" macro in type definition or defined "let field struct = struct.field" function, you can use |> for this purpose like this: struct |> field
<cheater>
is this some sort of non-technical shorthand, or is it actual ocaml syntax?
<Drup>
it's non-technical shorthand
<cheater>
OK
<cheater>
so it means i would have to write the code of my function
<cheater>
say
<cheater>
(foo bar baz ; x y z ; aaaaa)
<cheater>
and then follow it with : t1 * t2 list -> t1 ?
<cheater>
so in the end the last line would look like:
<Drup>
no, you don't need to write the second form, you should write the first form, and the rewriting is automatic
<cheater>
fun (type t1) (type t2) -> ((foo bar baz ; x y z ; aaaaa) : t1 * t2 list -> t1)
<cheater>
yeah but i mean
<cheater>
if i were using the second form
<Drup>
then yes
<cheater>
OK
<cheater>
i still don't understand why i would use the second form though (which i'm using to try and understand the first form)
<cheater>
what does fun type a ... mean?
nomicflux has quit [Quit: nomicflux]
<Drup>
it should be explained above in the documentation
ziyourenxiang has joined #ocaml
<cheater>
ah there it is
<cheater>
thank you
<cheater>
let me read that
<cheater>
also, another question, is there a difference between fun t1 -> ... and fun 't1 -> ... ?
<Drup>
but honestly, you shouldn't try to understand that in isolation. Those notations have a specific purpose (in particular, writing GADT or polymorphic recursion), you should only try to understand them when you get a use for it
<cheater>
i have code here which uses it and i'm trying to understand it
<cheater>
so i have a use for it
<cheater>
i'm not just randomly reading through the manual :)
<Drup>
so, I would propose you to try to write the code without the annotation first
<Drup>
and understand why it doesn't work
yomimono has quit [Ping timeout: 240 seconds]
<cheater>
Drup: i can't write the code without the annotation. it's a piece of code that exists already, and it's very large.
<orbifx-m>
toolslive: looked at lens?
yomimono has joined #ocaml
<toolslive>
I have now ;)
bungoman has joined #ocaml
bungoman_ has quit [Ping timeout: 256 seconds]
oschwald has joined #ocaml
govg has joined #ocaml
<orbifx-m>
:)
<orbifx-m>
is that what you want? it's got generators too
agarwal1975 has joined #ocaml
orbifx-m has quit [Remote host closed the connection]
sh0t has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
orbifx-m has joined #ocaml
<orbifx-m>
Drup: ppx deriving has show which is bytes, is that what you mean?
gjaldon has joined #ocaml
fraggle_ has joined #ocaml
<orbifx-m>
jerith: was your message regarding make for my question?
<jerith>
orbifx-m: No, toolslive's question. :-)
<jerith>
But it wasn't very helpful.
<jerith>
Maybe there's something in ppx_deriving for what you need, though.
MercurialAlchemi has quit [Ping timeout: 256 seconds]
ocp has quit [Ping timeout: 240 seconds]
<orbifx-m>
is Map mutable?
<Armael>
no
<Armael>
(e.g., Map.S.add has type key -> 'a -> 'a t -> 'a t, it takes a key, a value, a map, and returns a new map)
<Armael>
(with a mutable structure, it would probably have type key -> 'a -> 'a t -> unit)
<orbifx-m>
makes sense armael, thanks
shinnya has joined #ocaml
Siegfried has joined #ocaml
Siegfried has quit [Client Quit]
al-damiri has joined #ocaml
annoymouse has joined #ocaml
wtetzner has joined #ocaml
gjaldon has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
ziyourenxiang has quit [Quit: Leaving]
mengu has joined #ocaml
nahra has quit [Quit: ERC (IRC client for Emacs 25.1.1)]
mengu has quit [Ping timeout: 240 seconds]
tmtwd has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
tmtwd has quit [Ping timeout: 256 seconds]
MercurialAlchemi has joined #ocaml
jnavila has quit [Quit: It was time]
th5 has joined #ocaml
gjaldon has joined #ocaml
jao has joined #ocaml
kakadu has joined #ocaml
johnelse_ is now known as johnelse
frefity has quit [Ping timeout: 245 seconds]
lopex has joined #ocaml
frefity has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
Siegfried has joined #ocaml
Siegfried has quit [Client Quit]
lpaste_ has joined #ocaml
ryanartecona has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
ygrek has joined #ocaml
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
larhat has quit [Client Quit]
shinnya has quit [Ping timeout: 276 seconds]
lpaste has quit [Quit: Quit]
lpaste_ is now known as lpaste
philtor has joined #ocaml
slash^ has joined #ocaml
lpaste has quit [Changing host]
lpaste has joined #ocaml
yomimono has joined #ocaml
copy` has joined #ocaml
AltGr has left #ocaml [#ocaml]
vicfred has quit [Quit: Leaving]
djellemah has quit [Ping timeout: 256 seconds]
zpe has quit [Remote host closed the connection]
jnavila_ has joined #ocaml
agarwal1975 has joined #ocaml
agarwal1975 has quit [Client Quit]
agarwal1975 has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
pwzoii has quit [*.net *.split]
peddie has quit [*.net *.split]
tobast has quit [*.net *.split]
Asmadeus has quit [*.net *.split]
dmbaturin has quit [*.net *.split]
iyy has quit [*.net *.split]
k1000_ has quit [*.net *.split]
mal`` has quit [*.net *.split]
Pepe_ has quit [*.net *.split]
adrien has quit [*.net *.split]
cheater2 has quit [*.net *.split]
fredcy has quit [*.net *.split]
Asmadeus has joined #ocaml
dmbaturin has joined #ocaml
cheater2 has joined #ocaml
iyy has joined #ocaml
Pepe_ has joined #ocaml
fold4 has quit [*.net *.split]
gallais has quit [*.net *.split]
dinosaure has quit [*.net *.split]
jeroud has quit [*.net *.split]
tobast has joined #ocaml
fredcy has joined #ocaml
gallais has joined #ocaml
vodkaInferno has quit [*.net *.split]
jkni has quit [*.net *.split]
_habnabit has quit [*.net *.split]
engil has quit [*.net *.split]
dx has quit [*.net *.split]
rks- has quit [*.net *.split]
clog has quit [*.net *.split]
sheijk_ has quit [*.net *.split]
_2can has quit [*.net *.split]
manizzle has quit [Ping timeout: 245 seconds]
sheijk has joined #ocaml
_2can has joined #ocaml
rks- has joined #ocaml
vodkaInferno has joined #ocaml
clog has joined #ocaml
_habnabit has joined #ocaml
dinosaure has joined #ocaml
mal`` has joined #ocaml
engil has joined #ocaml
dx has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
pwzoii has joined #ocaml
fold4 has joined #ocaml
jeroud has joined #ocaml
ggherdov has quit [Ping timeout: 264 seconds]
yomimono has quit [Quit: Leaving]
annoymouse has quit [Ping timeout: 255 seconds]
annoymouse has joined #ocaml
peddie has joined #ocaml
ygrek has quit [Ping timeout: 256 seconds]
ggherdov has joined #ocaml
Siegfried has joined #ocaml
jkni has joined #ocaml
adrien has joined #ocaml
ggherdov has quit [Excess Flood]
ggherdov has joined #ocaml
agarwal1975 has joined #ocaml
nahra has joined #ocaml
<Bluddy[m]>
has anyone tried running ocaml on bash on windows?
orbifx-m has quit [Ping timeout: 240 seconds]
Sim_n has quit [Ping timeout: 240 seconds]
orbifx-m has joined #ocaml
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ygrek has joined #ocaml
frefity has quit [Ping timeout: 255 seconds]
Siegfried has joined #ocaml
oschwald has quit [Ping timeout: 260 seconds]
justicefries has joined #ocaml
toolslive has quit [Remote host closed the connection]
justicefries has quit [Client Quit]
calculemus has quit [Read error: Connection reset by peer]
oschwald has joined #ocaml
calculemus has joined #ocaml
frefity has joined #ocaml
<frefity>
hi, is there a way to check if an input or output channel has been closed?
TheLemonMan has joined #ocaml
KV has joined #ocaml
orbifx-m has quit [Ping timeout: 240 seconds]
philtor has quit [Ping timeout: 240 seconds]
KV has quit [Quit: leaving]
<th5>
frefity: Try to use them and catch the exception(?)
frefity has quit [Ping timeout: 240 seconds]
xyproto has left #ocaml ["WeeChat 1.7"]
philtor has joined #ocaml
Sim_n has joined #ocaml
justicefries has joined #ocaml
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snowcrshd has quit [Remote host closed the connection]
gjaldon has quit []
Siegfried has joined #ocaml
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wtetzner has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
justicefries has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
hunteriam has joined #ocaml
tane has joined #ocaml
Siegfried has joined #ocaml
th5 has quit [Remote host closed the connection]
tane has quit [Ping timeout: 256 seconds]
tane has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 248 seconds]
<flux>
to me it sounds a lot better idea to keep that information elsehwere, if that's important for your program's internal state :)
cdidd has quit [Ping timeout: 248 seconds]
MercurialAlchemi has joined #ocaml
<flux>
soo, is one expected to use ie. Lwt.choose [Lwt_unix.sleep 1.0; Lwt_unix.recv .. ] as a good timeout mechanism?
<flux>
because it's not working with Conduit's websocket (it returns eof on the next round)
simn__ has joined #ocaml
<Drup>
flux: Lwt.choose doesn't cancel the other threads
<Drup>
Lwt.pick does, but the notion of canceling in lwt is a bit delicate, you should read the details
<flux>
right. so what would be a good way to go about that? put the waited things to references so I can reuse them?
<flux>
I guess canceling would work if the thread is written that in mind?
Sim_n has quit [Ping timeout: 255 seconds]
<flux>
but yes, Lwt.pick works in this case, thank you :)
cdidd has joined #ocaml
justicefries has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Siegfried has joined #ocaml
manizzle has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
handlex has joined #ocaml
ryanartecona has joined #ocaml
handlex has quit [Quit: handlex]
manizzle has quit [Ping timeout: 276 seconds]
handlex has joined #ocaml
justicefries has quit [Ping timeout: 260 seconds]
ryanartecona has quit [Quit: ryanartecona]
handlex has quit [Ping timeout: 255 seconds]
jnavila_ has quit [Ping timeout: 252 seconds]
<flux>
hmm, is it me or is the WebSocket package not very big on closing client connections?-o
fraggle_ has quit [Ping timeout: 255 seconds]
pierpa has quit [Ping timeout: 240 seconds]
<Nazral>
hi
<Nazral>
how do I replace a character from a string in ocaml ?
kakadu has quit [Remote host closed the connection]
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<flux>
well, the current answer official is "you don't", strings are going to be immutable some day soon
<flux>
but, there is Bytes.t which is like strings, but you're able to modify them
<flux>
I think the answer there is bytes.[2] <- '4', as it is with strings currently, but honestly I don't know if that is going to work with Bytes :-o directly
Siegfried has joined #ocaml
<flux>
but the Bytes module has get/set for modifying its contents
fraggle_ has joined #ocaml
<Nazral>
ok
<Nazral>
thanks !
<Nazral>
I will do without it then :)
Siegfried has quit [Client Quit]
fraggle_ has quit [Ping timeout: 255 seconds]
annoymouse has quit [Quit: Connection closed for inactivity]
vramana has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
vramana has joined #ocaml
larhat has joined #ocaml
fraggle_ has quit [Ping timeout: 255 seconds]
<octachron>
flux, unfortunately, currently "a.[x] <- y" only works with string: in other words, the syntax '.[] <-' is a absolutely unusable with the -safe-string option
* octachron
grumble about prefering hypothetical solutions in hypothetical futures