<Algebr>
yea, I set non blocking on the underlying fd
pierpa has quit [Remote host closed the connection]
<Algebr>
really annoyed that calling really_input_string can hang
<aantron>
why wouldn't it? if len characters aren't available, and the fd isn't closed, it can't return you the characters
Guest76272 has quit [Remote host closed the connection]
johnelse has joined #ocaml
johnelse is now known as Guest59997
wu_ng has quit [Ping timeout: 258 seconds]
<Algebr>
So apparenly \r\n gets into strings differently if you use {||} rather than ""
copy` has joined #ocaml
zirman has joined #ocaml
Guest59997 is now known as johnelse
luzie has quit [Quit: luzie]
silver has quit [Quit: rakede]
<aantron>
Algebr: thats good to know. and quite crappy :p
snhmib has quit [Ping timeout: 245 seconds]
nomicflux has joined #ocaml
<_berke_>
trying out flambda on some bigarray code... I find that -inline-call-costs X is needed to make it effective on my test case. the slightly-abstract version is then only 30% slower.
luzie has joined #ocaml
johnelse has quit [Quit: leaving]
snhmib has joined #ocaml
Sim_n has quit [Quit: Leaving]
Sorella has quit [Quit: Connection closed for inactivity]
wolfcore has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
ziyourenxiang has joined #ocaml
zv has quit [Ping timeout: 258 seconds]
ra4king has joined #ocaml
annoymouse has joined #ocaml
jimt is now known as Jim7J1AJH
zv has joined #ocaml
wu_ng has joined #ocaml
wtetzner has joined #ocaml
zirmann has joined #ocaml
zirman has quit [Ping timeout: 268 seconds]
smondet has joined #ocaml
noddy has joined #ocaml
zirmann has quit [Remote host closed the connection]
snhmib has quit [Ping timeout: 264 seconds]
snhmib has joined #ocaml
wtetzner has quit [Remote host closed the connection]
mfp has quit [Ping timeout: 268 seconds]
ra4king has left #ocaml ["Leaving"]
jao has quit [Disconnected by services]
jao has joined #ocaml
zirman has joined #ocaml
annoymouse has quit [Quit: Connection closed for inactivity]
zirman has quit [Ping timeout: 250 seconds]
snhmib has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
nomicflux has quit [Quit: nomicflux]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
pierpa has joined #ocaml
snhmib has joined #ocaml
Algebr has quit [Ping timeout: 246 seconds]
shortCircuit__ has joined #ocaml
<shortCircuit__>
hi
<shortCircuit__>
I am new to ocaml, I want to know that, if I want to include extlib module and use its functions for reading files, as in the ocaml docs. How to do it.
<shortCircuit__>
?
MetaHertz has quit [Quit: Всем пока! // Goodbye everyone!]
manizzle has quit [Ping timeout: 260 seconds]
manizzle has joined #ocaml
jao has quit [Ping timeout: 256 seconds]
snhmib has quit [Ping timeout: 258 seconds]
noddy has quit [Ping timeout: 268 seconds]
pierpa has quit [Ping timeout: 248 seconds]
MercurialAlchemi has joined #ocaml
ygrek_ has quit [Ping timeout: 258 seconds]
d0nn1e has quit [Ping timeout: 250 seconds]
d0nn1e has joined #ocaml
<shortCircuit__>
plz help
Jim7J1AJH is now known as jimt
larhat has joined #ocaml
ygrek_ has joined #ocaml
shortCircuit__ has quit [Ping timeout: 260 seconds]
calculemus has joined #ocaml
pon1980 has quit [Ping timeout: 268 seconds]
trepta has quit [Ping timeout: 248 seconds]
richi235 has joined #ocaml
Onemorenickname has joined #ocaml
<Onemorenickname>
hi poeple
<Onemorenickname>
is there a shorthand in ocaml for "fun () -> (expr)" ?
<Onemorenickname>
(i really like CPS, lazyness and callbacks)
snhmib has joined #ocaml
zaquest has quit [Quit: Leaving]
<asmanur>
Onemorenickname: have you checked out the Lazy module ?
<asmanur>
(but it's not much shorter -- but you get memoization if that's something you're into)
<Onemorenickname>
asmanur, it still requires me to pass (fun () -> (expr))
<asmanur>
no
<asmanur>
you can do (lazy expr)
<Onemorenickname>
it's builtin syntax ?
<asmanur>
yep
<Onemorenickname>
oh
<Onemorenickname>
nice :)
<asmanur>
it's syntactic sugar for Lazy.from_fun (fun () -> expr)
<Onemorenickname>
is there a way to add syntactic sugar in ocaml ?
<asmanur>
yes
<asmanur>
look at "ppx"
<asmanur>
you can rewrite the parse tree which allows you to easily implement some syntactic sugar
<Onemorenickname>
hm
<Onemorenickname>
asmanur, is there a simple way to just do #define ~(X) (fun () -> (expr))
<asmanur>
with a ppx yeah, but otherwise no
<asmanur>
because ocaml is call-by-value (ie. it evaluates the argument before calling the function), there is no way to define eg. let ( ~ ) x = fun () -> x
<Onemorenickname>
well, i guess i'll have to dive in ppx
<Onemorenickname>
I meant to ask if there was a simple preprocessor library
<asmanur>
oh
<asmanur>
ppx is quite simply already
<Onemorenickname>
I'll look into it then
<Onemorenickname>
Thanks :)
sspi has quit [Quit: Connection closed for inactivity]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
ygrek_ has quit [Ping timeout: 246 seconds]
jnavila has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
infinity0 has quit [Remote host closed the connection]
Simn has joined #ocaml
infinity0 has joined #ocaml
infinity0 has quit [Changing host]
infinity0 has joined #ocaml
jnavila has quit [Ping timeout: 256 seconds]
Onemorenickname has quit [Read error: Connection reset by peer]
ziyourenxiang has quit [Quit: Leaving]
<orbitz>
is there good reason to belief effects are in ocaml's future as a way to manage side-effects?
wu_ng has quit [Remote host closed the connection]
wu_ng has joined #ocaml
kakadu has joined #ocaml
_andre has joined #ocaml
richi235 has quit [Remote host closed the connection]
psacrifice has joined #ocaml
<psacrifice>
Hey everyone. I just got started with OCaml and was trying out cohttp. In the example, I could not understand >|= operator in the server example
<psacrifice>
body |> Cohttp_lwt_body.to_string >|= (fun body ->
<Leonidas>
psacrifice: it takes a Lwt.t monad, pipes it though the function and wraps the function's return value in a new Lwt.t
<Leonidas>
it's basically >>= with an implicit Lwt.return
<Leonidas>
lobo: found the openlab/nixos assembly. I guess I'll hang out here a bit over the next days
<psacrifice>
@def Just what I was searching for @Leonidas Appreciate the explanation
<Leonidas>
psacrifice: it's a bit tricky at first but overall rather logical :)
<psacrifice>
@Leonidas Yeah. My first time with Monads that too :D
<Leonidas>
psacrifice: as long as you're not scared of the word too much you'll be fine. And if you have questions, feel free to ask them here. People are knowledgeable and helpful :)
<psacrifice>
Great to hear that. Always worried about posting questions in the wrong channel/forum otherwise :)
<Leonidas>
oh, seeing the previous discussion about ppx… I wonder whether it is possible to build if-let from clojure in ocaml, as an if%let, anyone has experience with writing ppx rewriters?
<flux>
what is clojure's if-let?
<flux>
sounds like a purely syntactic construct, so likely yes?
<Leonidas>
if-let is basically an if which checks the truthiness of the value which was set in the let and if true, executes a block with the value set and if false and else block
<flux>
so basically it would map to pattern matching 'a option? because ocaml doesn't have truthiness.
<flux>
well, other than bool ;)
<Leonidas>
flux: yes, that seems like the best way to map truthiness to ocaml
<flux>
if%let a = Some 42 then Printf.printf "a = %d" a else (* a is not bound here *) ()
<flux>
I think that would be perfectly doable, and easy as well
<Leonidas>
it's kinda like a >>= but with a third param for the None case
<Leonidas>
cool, then maybe I could try implementing it while at 33c3
<flux>
hmm, now this was unexpected. I received a mobile phone notification via the matrix-client riot due to the mention of the nick 'flux', though I'm here from there with the user m-erkkiseppl :)
<Leonidas>
flux: what would I use to construct such a rewriter? ppx_tools? ppx_driver? something else?
<flux>
I think ppx_tools
<flux>
and whitequark's ppx guide
<flux>
or ppx_tools examples if there were any..
richi235 has quit [Remote host closed the connection]
<psacrifice>
Question: Why is there a =<< when there already is a >>=? Isn't it good to always have one way of doing things like in Python?
<psacrifice>
Beginner here. Correct me if I'm wrong about something obv :) The question was in reference to LWT (ocsigen.org/lwt/2.6.0/api/Lwt#VALmap)
<Leonidas>
larhat: i have heard about it. Hmm, their if%bind looks pretty much what I want to do with my if%let but more general
<Leonidas>
psacrifice: sometimes you want to curry the function, sometimes you want to curry the monad, that's why there are both versions
<Leonidas>
you usually want >>=, but since there is no flip in ocaml =<< can potentially make sense. I've never used the latter though.
<larhat>
Leonidas: yes, that what I thought, and even if it's not exactly what you want, you can at least look at the source code to see, how implement smth like this
<Leonidas>
larhat: excellent point, will do! thanks!
<Leonidas>
so far i have an identity rewriter
<psacrifice>
@Leonidas Curry monad? Can I have an example?
<Leonidas>
psacrifice: let yourfun = (<<=) (fun x -> Lwt.return x)
ocaml105 has joined #ocaml
<ocaml105>
hello! i'm new to ocaml,
<ocaml105>
how do you guys use the [@@deriving ...] syntax with emacs and utop?
<flux>
ocaml105, does #require "deriving.std";; in utop work?
infinity0 has quit [Remote host closed the connection]
<ocaml105>
ah yes!
FreeBirdLjj has joined #ocaml
<psacrifice>
Reader.file_contents filename
<psacrifice>
>>= fun text ->
<psacrifice>
@Leonidas I dont understand. Where is the Monad that is being binded? So far I have only seen a monad on the left like in
<flux>
ocaml105, then you can append that to your ~/.ocamlinit
<psacrifice>
the above snippet
<psacrifice>
@ocaml105 Hi
<ocaml105>
is there any way to let emacs' utop read from the .merlin file or something liek that?
<Leonidas>
psacrifice: you bind the function. if you'd use >>= then it'd bind the monad.
infinity0 has joined #ocaml
<flux>
it would be possible to write one that would use the toplevel libs (I don't know of them really, but like findlib itself) and then put an invocation to the end of .ocamlinit
<flux>
seems like it would be a nice tool to have.
<psacrifice>
@Leonidas I see. I'll keep in mind. Thank you
<Leonidas>
flux: that sounds useful, indeed
<Leonidas>
maybe if I get ppx_iflet out of the door quickly :D
<flux>
leonidas, so I guess you have some spare time in these days between christmas and new year ;-)
<flux>
"hey everyone, leonidas is bored af and needs project ideas to keep him entertained!!" :-)
<ocaml105>
hahhah
FreeBirdLjj has quit [Ping timeout: 268 seconds]
<ocaml105>
you guys are great
<ocaml105>
actually...
<ocaml105>
after putting it in ocamlinit it doesn't work anymore...
<flux>
ocaml105, which .ocamlinit did you put it in?
<ocaml105>
is the order of commands in ocamlinit important?
<ocaml105>
~/.ocamlinit
<flux>
ocaml105, well yes, it's evaluated top to bottom
<aantron>
lujara: you have at least a syntax error, you need } at the end of the record, not )
<aantron>
if i fix it, the definitions are accepted
<aantron>
but the error in the meantime is a syntax error
<lujara>
aantron, my bad, typed that manually because i code on my laptop but am on my pc
<lujara>
the actual code doesnt have that syntax error
psacrifice has joined #ocaml
richi235 has joined #ocaml
<lujara>
ffs i had another type with the same name declared further above >.<
ziyourenxiang has quit [Quit: Leaving]
pierpa has joined #ocaml
larhat1 has quit [Quit: Leaving.]
nomicflux has joined #ocaml
zirman has quit [Remote host closed the connection]
<aantron>
:)
nomicflux has quit [Quit: nomicflux]
<lujara>
thanks btw :p
tg has quit [Ping timeout: 258 seconds]
zirman has joined #ocaml
tg has joined #ocaml
psacrifice has quit [Remote host closed the connection]
psacrifice has joined #ocaml
_berke_ has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 258 seconds]
wtetzner has joined #ocaml
<Leonidas>
flux: deriving might not be ppx_deriving but ocsigen deriving?
nomicflux has joined #ocaml
nomicflux has quit [Quit: nomicflux]
noddy has joined #ocaml
nomicflux has joined #ocaml
infinity0 has quit [Remote host closed the connection]
zirman has quit [Remote host closed the connection]
jnavila has joined #ocaml
xorpse has joined #ocaml
smondet has quit [Remote host closed the connection]
nomicflux has quit [Quit: nomicflux]
luzie has quit [Quit: luzie]
luzie has joined #ocaml
xorpse has quit [Quit: leaving]
xorpse has joined #ocaml
psacrifi_ has joined #ocaml
psacrifice has quit [Ping timeout: 245 seconds]
richi235 has quit [Remote host closed the connection]
richi235 has joined #ocaml
AdmWiggin is now known as tianon
trepta has joined #ocaml
jnavila has quit [Ping timeout: 256 seconds]
jnavila has joined #ocaml
zirman has joined #ocaml
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
ski has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
gpietro has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
jnavila has quit [Ping timeout: 260 seconds]
agarwal1975 has joined #ocaml
jnavila has joined #ocaml
copy` has joined #ocaml
ygrek_ has quit [Ping timeout: 256 seconds]
kakadu has joined #ocaml
nomicflux has joined #ocaml
moei has quit [Quit: Leaving...]
noddy has quit [Ping timeout: 258 seconds]
<Leonidas>
writing ppx wrappers is pretty easy and fun
<flux>
:)
isd has joined #ocaml
_andre has quit [Quit: leaving]
jnavila has quit [Ping timeout: 256 seconds]
ygrek_ has joined #ocaml
igt0_ has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
nomicflux has quit [Quit: nomicflux]
<orbitz>
What's the suggested time library to use? I want to, type safely, creat times, diff times, etc
<flux>
I think CalendarLib is pretty comprehensive. perhaps even too comprehensive ;)
nomicflux has joined #ocaml
jao has quit [Ping timeout: 248 seconds]
johnelse has joined #ocaml
d0nn1e has quit [Ping timeout: 252 seconds]
d0nn1e has joined #ocaml
jnavila has joined #ocaml
smondet has joined #ocaml
jao has joined #ocaml
zirman has quit [Remote host closed the connection]
octachron has joined #ocaml
infinity0 has joined #ocaml
snhmib has quit [Ping timeout: 250 seconds]
zirman has joined #ocaml
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
snhmib has joined #ocaml
psacrifice has joined #ocaml
psacrifi_ has quit [Ping timeout: 252 seconds]
sepp2k1 has joined #ocaml
rand__ has quit [Ping timeout: 256 seconds]
octachron has quit [Quit: Leaving]
sepp2k1 has quit [Ping timeout: 245 seconds]
nomicflux has quit [Quit: nomicflux]
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
zirman has quit [Ping timeout: 252 seconds]
isd has quit [Read error: Connection reset by peer]
kakadu_ has joined #ocaml
jnavila has quit [Write error: Broken pipe]
sfri has quit [Write error: Broken pipe]
jnavila_ has joined #ocaml
sfri has joined #ocaml
wtetzner has quit [Remote host closed the connection]
psacrifice has quit [Remote host closed the connection]
kakadu has quit [Ping timeout: 264 seconds]
isd has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
jnavila_ has quit [Ping timeout: 256 seconds]
ocaml426 has joined #ocaml
<ocaml426>
hi! new to ocaml....
<ocaml426>
what does the pound sign mean in ocaml?
<ocaml426>
does it only belong in the toplevel? or is it ok in code too?
<ocaml426>
or, what is the pound sign called? (like #require "ppx_deriving.std") so I can google it
<Leonidas>
ocaml426: where is a pound sign?
<Drup>
(for a while, I was like "but £ is not used in OCaml ...")
<Leonidas>
ocaml does not really use a pound sign
<Drup>
ocaml426: we usually call it hash
<Leonidas>
it's french, so € should be used :p
<Drup>
ocaml426: in the case you described, it's for toplevel directives
nomicflux has joined #ocaml
<Drup>
Leonidas: well, ocaml was created before euro, so ₣ :D
<Leonidas>
there are also cases where you use | #foo in a pattern match
<Leonidas>
TIL Franc had a currency sign
<flux>
and everybody forgets objects.. :)
<Leonidas>
yeah, objects too
<Drup>
flux: as always ;)
<ocaml426>
i see, oops
<Leonidas>
yeah, OCaml means that it's irish, not that its Objective :p
<ocaml426>
yes haha ocaml is rather european, i forgot
<Leonidas>
anyway, in that case it's a toplevel directive, not part of the language
<Drup>
Leonidas: In old paper, you can ocasionally find it written "O'CAML"
<isd>
Drup: I once took an operating systems course (in the US) with a British professor. One day I was looking at his code and my terminal did something weird, and I started seeing £include <...>; it was the freakiest thing ever.
<Drup>
(yes, I'm not kidding, I've seen it)
<Leonidas>
Drup: or when reading anything written by Gerd.
<Drup>
Leonidas: it makes my eye bleed everytime
<Drup>
eyes* even
<Leonidas>
oh, Gerd seems to have changed it, can't find it anymore
vicfred has quit [Quit: Leaving]
<Drup>
Leonidas: anyway, recently, I stumbled upon an article with "and an implementation in Caml 3.1"
<Drup>
"The first Caml implementation in Lisp was nicknamed "Heavy CAML" because of its memory and CPU requirements relative to its successor Caml Light that was implemented in C by Xavier Leroy and Damien Doligez. In addition to a complete rewriting, CAML Special Light added a powerful (applicative) module system to the core language."
<Leonidas>
ocaml426: you might need ppx_deriving.show
* Drup
brb, adding "powered by HEAVY CAML" in his readme
<dmbaturin>
I wonder if the source code of the HEAVY CAML survived, it sure would be fun to try it on modern hardware.
infinity0 has quit [Remote host closed the connection]
zirman has joined #ocaml
<dmbaturin>
The original ML is aparently so lost that not even complete grammar survived, the papers have nothing in the interpreter implementation.
<dmbaturin>
* on
infinity0 has joined #ocaml
psacrifice has joined #ocaml
zirman has quit [Ping timeout: 248 seconds]
psacrifice has quit [Ping timeout: 246 seconds]
demonimin has quit [Remote host closed the connection]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
xorpse has quit [Ping timeout: 245 seconds]
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
rand__ has joined #ocaml
demonimin has joined #ocaml
xorpse has joined #ocaml
rand__ has quit [Client Quit]
kakadu_ has quit [Remote host closed the connection]
<Drup>
dmbaturin: caml light is very well documented, though
<dmbaturin>
Yeah, it also still builds cleanly even on very recent systems.
<Leonidas>
ocaml426: well, when I require that in utop it works
ocaml426 has quit [Ping timeout: 260 seconds]
<Leonidas>
it also generates the pp_test and stuff
<dmbaturin>
Anyway, I'm going to ask THAT question again. ;)
<dmbaturin>
If I want to add ocaml-protoc as a build step to oasis/ocamlbuild setup, what's the best way to do it?
<Leonidas>
caml light has constructor functions, ffs :(
<Drup>
ocaml-protoc ?
<dmbaturin>
The protobuf compiler.
<dmbaturin>
Leonidas: I think I've seen some justification for not making them functions somewhere, but I forgot what it was or where I've seen it. :)
<Leonidas>
I could image this might create issues with weak polymorphism, your constructors get tainted by '_a
<Leonidas>
but i don't know enough about thetye inference algorithm
wtetzner has joined #ocaml
<Drup>
Leonidas: meh, no
<dmbaturin>
I could run protoc by hand and add the generated files to git, but I really don't like having to actively do anything to ensure autogenerated files are in sync with reality.
<dmbaturin>
Though oasis and ocaml-protoc and whatever else is going to be a headache for the packagers, so I get to find some balance anyway.
<Leonidas>
Drup: then why?
<Drup>
it's a long and annoying debate, you can search the mailing list
<Leonidas>
I wouldn't even know what to search for