<seangrove>
flux: I've been hoping/prodding/pleading Algebr` to explore that route, it's one of the most exciting applications of OCaml for a lot of peope
<seangrove>
It's going to be pretty prickly/painful for the first pioneer down there, but they'll be doing a lot of good for the rest of us
Mercuria1Alchemi has quit [Ping timeout: 246 seconds]
noddy has joined #ocaml
<seangrove>
What json lib should I be using with auto-json deriving stuff? Yojson?
sz0 has quit [Quit: Connection closed for inactivity]
pyon has joined #ocaml
<zozozo>
seangrove: ppx_deriving_yojson ?
<seangrove>
zozozo: Yeah, using that, thanks
noddy has quit [Ping timeout: 240 seconds]
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
pyon has quit [Ping timeout: 260 seconds]
<Drup>
seangrove: eliom people have been doing mobile applications (with cordova) lately
malina has quit [Ping timeout: 246 seconds]
fraggle_ has joined #ocaml
dsheets has quit [Remote host closed the connection]
malina has joined #ocaml
<flux>
but then you would be using cordova.. of course, impossible to say if react native is any better :)
BitPuffin has joined #ocaml
seangrove has quit [Ping timeout: 244 seconds]
dsheets has joined #ocaml
ditadi has joined #ocaml
mettekou has joined #ocaml
mettekou has quit [Client Quit]
leyyin has quit [Quit: So Long, and Thanks for All the Fish]
AlexRussia has joined #ocaml
sh0t has joined #ocaml
ditadi has quit [Quit: WeeChat 1.4]
pyon has joined #ocaml
malina has quit [Ping timeout: 244 seconds]
rgrinberg has joined #ocaml
pyon has quit [Remote host closed the connection]
sh0t has quit [Ping timeout: 276 seconds]
pyon has joined #ocaml
seangrove has joined #ocaml
d0nn1e has quit [Ping timeout: 244 seconds]
d0nn1e has joined #ocaml
seangrove has quit [Ping timeout: 276 seconds]
pyon has quit [Ping timeout: 260 seconds]
pyon has joined #ocaml
zpe has quit [Remote host closed the connection]
sz0 has joined #ocaml
pyon has quit [Ping timeout: 246 seconds]
seangrove has joined #ocaml
pyon has joined #ocaml
seangrove has quit [Ping timeout: 264 seconds]
noddy has joined #ocaml
dsheets_ has joined #ocaml
dsheets has quit [Ping timeout: 246 seconds]
seangrove has joined #ocaml
seangrov` has joined #ocaml
noddy has quit [Quit: "it's a bit backwards around here"]
sh0t has joined #ocaml
pyon has quit [Ping timeout: 252 seconds]
seangrove has quit [Ping timeout: 252 seconds]
seangrov` has quit [Ping timeout: 244 seconds]
njvg has quit [Quit: Page closed]
copy` has joined #ocaml
tennix has quit [Ping timeout: 246 seconds]
MercurialAlchemi has quit [Ping timeout: 248 seconds]
MercurialAlchemi has joined #ocaml
hcarty has joined #ocaml
tmtwd has joined #ocaml
darkf has quit [Quit: Leaving]
<Leonidas>
seako: I use ppx_deriving_yojson, works alright.
<Leonidas>
seangrove, I should watch out what nick I autocomplete
kushal has quit [Quit: Leaving]
mistermetaphor has joined #ocaml
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 250 seconds]
tennix has joined #ocaml
seangrove has joined #ocaml
dsheets_ has quit [Remote host closed the connection]
matason has joined #ocaml
<zozozo>
quick question: say you have to implement a function type with named parameters, is there a way to have named parameters not used in the function body, but without triggering the related warning ? I could do something like [@@@ocaml.warning "-27"], but I was wondering if there was another better way ?
dsheets has joined #ocaml
kushal has joined #ocaml
<Leonidas>
let _ = your_arg in …?
<zozozo>
Leonidas: the function should have type : "x:int -> int" for instance
<companion_cube>
let f ~x:_ = ...
<zozozo>
companion_cube: thx
<Leonidas>
even better
<companion_cube>
can also be used to rename a named arg
<companion_cube>
~f:foo
<companion_cube>
?f:(foo=42)
<companion_cube>
:D
<companion_cube>
ok, arcane syntax, much
slash^ has joined #ocaml
matason has quit [Ping timeout: 252 seconds]
FreeBird_ has quit [Remote host closed the connection]
<Leonidas>
companion_cube: how do you come up with such things? do you read through the parser when bored? ;-)
<companion_cube>
no
<companion_cube>
I met the same problem, and managed to find the solution in the manual :D
<companion_cube>
afaicr
FreeBirdLjj has joined #ocaml
<companion_cube>
I like optional arguments, which explains why I know some corners
<def`>
Leonidas: this is a nice practice :)
<Drup>
The parser is a great read, it's full of surprises
FreeBirdLjj has quit [Ping timeout: 264 seconds]
pierpa has joined #ocaml
nicholasf has joined #ocaml
chindy has joined #ocaml
johnf has joined #ocaml
lokien_ has joined #ocaml
<struktured>
companion_cube: cool trick
wiredsister has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
larhat has quit [Quit: Leaving.]
nicholasf has quit [Remote host closed the connection]
Algebr has joined #ocaml
shinnya has joined #ocaml
Kakadu has joined #ocaml
ygrek has joined #ocaml
foocraft has joined #ocaml
orbifx has joined #ocaml
tennix has quit [Ping timeout: 252 seconds]
<seangrove>
Is there a way to get Lwt to unwrap a value (blocking on it if necessary)?
<flux>
Lwt_unix.run
<seangrove>
flux: Hrm, will that work on Mirage or jsoo?
<flux>
probably not
octachron has joined #ocaml
shinnya has quit [Ping timeout: 268 seconds]
sh0t has quit [Ping timeout: 250 seconds]
djellemah_ has joined #ocaml
<seangrove>
Say I have a list of lwt items, e.g. post Lwt.t list, and I want to make it a Lwt.t post list, how do I go about that?
<seangrove>
Bah, >>= is probably what I want
orbifx has quit [Ping timeout: 246 seconds]
<seangrove>
(unwrapping both items is proving a little tricky in my head)
rpip has quit [Ping timeout: 250 seconds]
rpip has joined #ocaml
sepp2k has quit [Quit: Leaving.]
<flux>
certainly >>= is what you usually do
<flux>
there are also nice ppx extensions available to make that slightly less syntactically heavy
<flux>
Lwt provides its only list functions that deal with the monad
sepp2k has joined #ocaml
<flux>
I don't use Lwt a lot but perhaps you are looking something like what I updated to the gist
<seangrove>
flux: I thought cb-hell was the stackign up of anonymous functions
<seangrove>
Oh, that does look a lot nicer!
<flux>
actually that's a bit wrong, there is no lwt_acc required at all
<seangrove>
Sure, no problem
nicholasf has quit [Ping timeout: 240 seconds]
<flux>
is the operation in fact a bit no-op.. :) Lwt_list.map Lwt.return posts
dsheets has quit [Remote host closed the connection]
<flux>
I expect Lwt actually has that function already implemented in Lwt_list
dsheets has joined #ocaml
<flux>
in fact you should just do let lwt_posts = Lwt.list.map (fun post -> read_fs fs post.file) posts :-)
<flux>
and even further: let%lwt posts' = ..
lokien_ has quit [Quit: Connection closed for inactivity]
<flux>
I guess a lot of time the value an Lwt monad has is extracted right away with the binding operation (let%lwt or >>=)
<flux>
instead of held arond, unless you need to put them through some pure facilities like List.map, just like you had done
<seangrove>
flux: I'm not sure I get the "and even further" part - are you saying it can be collapsed into one expression?
<seangrove>
One moment, I think it might be able to! :)
dsheets has quit [Ping timeout: 276 seconds]
djellemah has quit [Disconnected by services]
djellemah_ is now known as djellemah
djellemah_ has joined #ocaml
mettekou has joined #ocaml
ggole has quit []
dsheets has joined #ocaml
<flux>
companion_cube, oh you moved containers.misc to its own package, makes sense. but now I need to fix my builds!
<Drup>
seangrove: you should take a closer look at Lwt_list
dsheets has quit [Ping timeout: 250 seconds]
<seangrove>
Drup: I've certainly looked through it, had been using a few functions, but will poke around some more
<flux>
the ability to understand how to apply those functions will come with experience, it seems you have had a few of those heureka-moments already :).
<Drup>
(and btw, this is not really callback hell, more like monad stack hell)
<flux>
I would call it hell only after more than one monad is involved
AlexRussia has quit [Quit: WeeChat 1.4-dev]
<Drup>
flux: 2, Lwt and List
<flux>
well List is not being used monadically here, though I suppose it's quite close with its higher-order-functions
TheLemonMan has joined #ocaml
octachron has quit [Quit: Leaving]
hydan has quit [Quit: hydan]
slash^ has quit [Read error: Connection reset by peer]
hydan has joined #ocaml
hydan has quit [Remote host closed the connection]
mistermetaphor has quit [Remote host closed the connection]
Algebr has quit [Ping timeout: 260 seconds]
wiredsister has quit [Ping timeout: 268 seconds]
mistermetaphor has joined #ocaml
dsheets has joined #ocaml
BitPuffin has quit [Ping timeout: 276 seconds]
dsheets has quit [Ping timeout: 250 seconds]
silver has quit [Read error: Connection reset by peer]
silver has joined #ocaml
sh0t has joined #ocaml
malina has joined #ocaml
zpe has joined #ocaml
igitoor has quit [Ping timeout: 246 seconds]
igitoor has joined #ocaml
johnf has quit [Ping timeout: 246 seconds]
AlexRussia has joined #ocaml
<MercurialAlchemi>
companion_cube: is there an lwt version of gen somewhere?
barcotoco has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
<barcotoco>
How can I get an OCaml program to print strings iteratively and not at the end of the program execution?
<zozozo>
barcotoco: insert a print statement inside your program
<zozozo>
howver AFAIR, channels are buffered in ocamls so you might want to flush the output if you want it to appear at the time you expect
<zozozo>
so, in practice do things like: Format.printf "Hello world !@." (notice the @. at the end, which prints a newline and flushes the printer)
barcotoco has quit [Ping timeout: 250 seconds]
<Simn>
Oh that's nice, now I don't have to write `print_endline (Printf.sprintf ...)` anymore.
barcoloco has joined #ocaml
sepp2k has quit [Quit: Leaving.]
johnf has joined #ocaml
<zozozo>
Simn: well, Format has plenty of other shiny and useful features, such as boxes
barcoloco has quit [Client Quit]
johnf has quit [Ping timeout: 264 seconds]
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<reynir>
Is it »Printf.printf "hello world%!"«?
<reynir>
yes
<j0sh>
\n doesn't flush Printf.printf?
<zozozo>
j0sh: why would it ? it's just an end of line character
A1977494 has quit [Remote host closed the connection]
johnf has joined #ocaml
Anarchos has joined #ocaml
johnf has quit [Ping timeout: 276 seconds]
<mahem1>
Hmmm, anyone familiar with js_of_ocaml here?
<reynir>
zozozo: Line buffering is quite common
<reynir>
mahem1: yes, there are people here familiar with jsoo
<zozozo>
reynir: I didn't know, probably because I code almost excluisvely in ocaml, :p
djellemah has quit [Ping timeout: 246 seconds]
<mahem1>
Ok, so I am wondering how to properly pass data to and from ocaml and js. At the moment I can passing strings and numbers, but I am getting stuck on lists, records, objects...
<mahem1>
I looked into JSON parsing, but it seems to be rather verbose.
chindy has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
johnf has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Nahra has quit [Ping timeout: 250 seconds]
ollehar1 has joined #ocaml
ollehar1 has quit [Client Quit]
ollehar1 has joined #ocaml
ollehar1 has quit [Client Quit]
Anarchos has quit [Excess Flood]
foocraft has quit [Remote host closed the connection]
teknozulu_ has quit [Ping timeout: 244 seconds]
fraggle_ has quit [Ping timeout: 246 seconds]
hcarty has quit [Ping timeout: 250 seconds]
fraggle_ has joined #ocaml
Algebr has joined #ocaml
nicholasf has joined #ocaml
Kakadu has quit [Remote host closed the connection]
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
badon has quit [Ping timeout: 244 seconds]
darkf has joined #ocaml
sh0t has quit [Ping timeout: 248 seconds]
Simn has quit [Quit: Leaving]
Jane-PC has joined #ocaml
Jane-PC has quit [Changing host]
Jane-PC has joined #ocaml
<companion_cube>
flux: oh sorry! what do you need from containers.misc?
<companion_cube>
I need to talk to mercurial tomorrow..
Nahra has joined #ocaml
sh0t has joined #ocaml
zpe has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
mettekou has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mettekou has joined #ocaml
mettekou has quit [Client Quit]
silver has quit [Quit: rakede]
seangrov` has joined #ocaml
madroach has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
seangrove has quit [Ping timeout: 246 seconds]
Jane-PC has quit [Remote host closed the connection]
chindy has joined #ocaml
seangrov` has quit [Ping timeout: 264 seconds]
mistermetaphor has quit [Remote host closed the connection]