Haudegen has quit [Remote host closed the connection]
cbot_ has joined #ocaml
ziyourenxiang has joined #ocaml
cbot has quit [Ping timeout: 245 seconds]
ziyourenxiang has quit [Ping timeout: 245 seconds]
Jesin has joined #ocaml
FreeBirdLjj_ has joined #ocaml
FreeBirdLjj_ has quit [Client Quit]
cbot_ has quit [Ping timeout: 240 seconds]
spew has quit [Quit: Leaving]
gtrak has joined #ocaml
BitPuffin has quit [Remote host closed the connection]
orbifx has quit [Quit: WeeChat 2.0.1]
seangrove has joined #ocaml
gtrak has quit [Ping timeout: 240 seconds]
zolk3ri has quit [Remote host closed the connection]
sh0t has quit [Remote host closed the connection]
jimt is now known as Jim7J1AJH
shinnya has quit [Ping timeout: 240 seconds]
mfp has quit [Ping timeout: 248 seconds]
gtrak has joined #ocaml
sh0t has joined #ocaml
Denommus has quit [Ping timeout: 268 seconds]
gtrak has quit [Ping timeout: 245 seconds]
sh0t has quit [Remote host closed the connection]
sh0t has joined #ocaml
Guest25308 has quit [Ping timeout: 252 seconds]
seangrove has quit [Ping timeout: 256 seconds]
sh0t has quit [Remote host closed the connection]
seangrove has joined #ocaml
seangrove has quit [Ping timeout: 245 seconds]
chat has joined #ocaml
chat is now known as Guest51114
govg has joined #ocaml
cbot_ has joined #ocaml
zmt00 has quit [Read error: Connection reset by peer]
zmt00 has joined #ocaml
butterthebuddha has quit [Ping timeout: 240 seconds]
butterthebuddha has joined #ocaml
pierpa has quit [Quit: Page closed]
butterthebuddha has quit [Max SendQ exceeded]
mbuf has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
butterthebuddha has joined #ocaml
ygrek has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
cross has quit [Quit: Lost terminal]
mk9 has joined #ocaml
MercurialAlchemi has joined #ocaml
mk9 has quit [Quit: mk9]
al-damiri has quit [Quit: Connection closed for inactivity]
Guest45028 has joined #ocaml
gentauro has quit [Ping timeout: 245 seconds]
gentauro has joined #ocaml
AltGr has joined #ocaml
Guest45028 is now known as Haudegen
argent_smith has joined #ocaml
orbifx1 has joined #ocaml
sapristi has joined #ocaml
cuicui has joined #ocaml
<_xvilka_>
hi
<_xvilka_>
how to unwrap from the Lwt.t type?
mk9 has joined #ocaml
<_xvilka_>
e.g. I have a thread returning "result" type, want to match it with | O, | Error, but the returning type is wrapped in Lwt.t, how to unwrap from it?
<rgr[m]>
You shouldn't "unwrap" it normally. You should either bind and map on the value.
<rgr[m]>
But if you really want to unwrap (essentially do a blocking operation), use Lwt_main.run
<_xvilka_>
rgr[m]: so I can use Lwt_main.run outside of the main loop?
<orbifx1>
_xvilka_: you don't unwrap it because an Lwt.t is a computation that is not complete. You use Lwt_main.run to tell it to do that.
<orbifx1>
_xvilka_: there is no main loop :)
<orbifx1>
That said, it would be strange to not have Lwt run your overall threading if you are using it.
mengu has joined #ocaml
<_xvilka_>
orbifx1: I have Lwt running in other places, just need to make a quick hack here to get the value, refactoring for proper "flow" will be later
<rgr[m]>
Just because you have an Lwt.t value doesn't mean the value is still being computed btw. Using Lwt.state (Lwt.return "foo")) will verify that.
<_xvilka_>
didn't knew about ability to use Lwt_main.run in the multiple places
<rgr[m]>
Yeah, using Lwt_main.run should be safe from a correctness standpoint. The only issue is performance of course.
<_xvilka_>
thank you
cbot_ has quit [Quit: Leaving]
mk9 has quit [Remote host closed the connection]
sapristi has quit [Read error: Connection reset by peer]
nullifidian_ has quit [Remote host closed the connection]
mk9 has joined #ocaml
<_xvilka_>
as it turned refactoring is still faster
orbifx1 has quit [Ping timeout: 240 seconds]
sapristi has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
nullifidian has joined #ocaml
mengu_ has joined #ocaml
orbifx has joined #ocaml
<rgr[m]>
Yeah, staying within Lwt.t shouldn't be hard at all. Especially if you're adept with the syntax extension
Jim7J1AJH is now known as jimt
ziyourenxiang has joined #ocaml
ziyourenxiang has quit [Quit: Leaving]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 has joined #ocaml
infinity0 has quit [Killed (rajaniemi.freenode.net (Nickname regained by services))]
orbifx1 has joined #ocaml
cuicui has quit [Ping timeout: 265 seconds]
_habnabit has quit [Ping timeout: 240 seconds]
orbifx has quit [Ping timeout: 256 seconds]
orbifx1 is now known as orbifx
cuicui has joined #ocaml
_habnabit has joined #ocaml
ziyourenxiang has joined #ocaml
dhil has joined #ocaml
mk9_ has joined #ocaml
sapristi has quit [Remote host closed the connection]
mk9 has quit [Ping timeout: 240 seconds]
mk9_ is now known as mk9
sapristi has joined #ocaml
mfp has joined #ocaml
kakadu has joined #ocaml
jimmyrcom has quit [Ping timeout: 240 seconds]
maattdd_ has joined #ocaml
xfbs has joined #ocaml
xfbs has quit [Read error: Connection reset by peer]
xfbs has joined #ocaml
mk9 has quit [Quit: mk9]
mk9 has joined #ocaml
zolk3ri has joined #ocaml
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
orbifx1 has joined #ocaml
orbifx1 has quit [Ping timeout: 276 seconds]
zolk3ri has quit [Ping timeout: 256 seconds]
zolk3ri has joined #ocaml
shinnya has joined #ocaml
mk9_ has joined #ocaml
<remix2000>
Hiya! What are use cases of OOP in OCaml?
mk9_ has quit [Client Quit]
mk9 has quit [Ping timeout: 240 seconds]
<Drup>
Limited :p
mk9 has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
<Drup>
Type tricks, Some very specific cases of inheritance, and open-recursion/visitors
<Drup>
that pretty much covers all the practical use cases
<remix2000>
Drup: can you explain what is open recursion, in simple words? First time I hear that term.. I don't understand the explanation on SO. :P
<Drup>
remix2000: you know the concept of visitors ?
<orbifx>
remix2000: to add to Drup's answer, if by Object Orientation you are thinking organising your overall code organisation into classes, then none. :)
<remix2000>
No, I have no idea what they are, Drup.
<Drup>
Ok, the article on wikipedia is full of Java rubish, so that's not a great source x)
<orbifx>
Drup: I suspect remix2000 is thinking about overal hierarchy and placement of code in classes
<Drup>
orbifx: ah, that might be
<remix2000>
orbifx: no, I want to learn OCaml mainly because it's functional. I don't want to learn another Java.. :P
<remix2000>
I just guessed that objects in OCaml have some specific use cases
<orbifx>
k, Object Orientation is not Objects. OCaml makes seldom use of them. I think it would have been great if thelanguage didn't have the O part :)
<Drup>
remix2000: on open-recursion/visitor: The question comes up when you want to write transformation on recursive structures, like syntax trees
<orbifx>
remix2000: not really. I have seen them being used as a way to bind to languages that have objects, but nothing important. I think you will really know if you ever have to use them.
<Drup>
the part that does the recursion if very boring and exactly the same, regardless of what transformation you implement
<Drup>
so you want to write a "common traversal"
<Drup>
but you also want to be able to replace some cases to implement your transformation
<Drup>
hence "open recursion": it's a recursive traversal where some parts can be replaced
<Drup>
OCaml objects provide a decent solution for that
<flux[m]>
Why isn't OO suitable for organizing code in OCaml? Sure you need to use modules as well..
<flux[m]>
sadly classes cannot contain types and recursion among types and classes is highly annoying
<Drup>
flux[m]: well, modules are just better at this job
zpe has quit [Remote host closed the connection]
mbuf has quit [Quit: Leaving]
<flux[m]>
on the other hand with classes you can write higher order functionality without using module syntax, which is basically a sub-language
zpe has joined #ocaml
mk9 has joined #ocaml
<Drup>
You just now need to use object syntax! Much better :D
<Drup>
(well, modules are also significantly more expressive)
<flux[m]>
stuff like let map : 'a -> 'b -> 'a container -> 'b container = .. becomes possible
mk9 has quit [Client Quit]
<flux[m]>
maybe it's the reason of modules why it's frustrating to have functions in ocaml that can accept multiple kind of containers ;). btw, how did the enumeration ocaml proposal go?
zpe has quit [Ping timeout: 248 seconds]
mk9 has joined #ocaml
mk9 has quit [Client Quit]
mk9 has joined #ocaml
mk9 has quit [Ping timeout: 245 seconds]
mk9 has joined #ocaml
mk9 has quit [Ping timeout: 248 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
mengu_ has quit [Remote host closed the connection]
zpe has joined #ocaml
<octachron>
small english question: "englobing box" for "parent box/wrapping box" is very french, isn'it?
<Drup>
yes
<octachron>
Drup, so I was not hypercorrecting, thanks.
<Drup>
I'm pretty sure it's understandable for non-french english speakers
<jbrown>
enclosing?
zpe has quit [Read error: Connection reset by peer]
zpe_ has joined #ocaml
<octachron>
Drup, for a native speaker certainly, but is this still the case for a Japanese/Russian student?
<octachron>
jbrown, ah yes, this may be better, thanks
FreeBirdLjj has joined #ocaml
<orbifx>
I don't know how one can say "enclosing, parent or wrapping box" in any simpler terms. Can use "context" but that isn't really an analogy, if that is what you're after.
<orbifx>
Container maybe?
sh0t has joined #ocaml
gtrak has joined #ocaml
<remix2000>
is `ignore @@ return_something abc;` a proper way to handle function that returns something in imperative context? I saw also `>>= fun x -> …` somewhere.. What do you think?
<remix2000>
When i want to save the result, I often use `let ... in`
mk9 has joined #ocaml
<Fardale>
remix2000: ignore will discard the return value, so what you want is the side effect of the function
<Fardale>
?
<remix2000>
I want to know what are good practices in both cases :)
<remix2000>
Fardale: ↑
<Fardale>
I don't understand what are the 2 cases here
MercurialAlchemi has quit [Ping timeout: 248 seconds]
<orbifx>
remix2000: `return` is not some kind of special built-in like other languages, which escapes the flow of evaluation.
<orbifx>
it actually "yields" or constructs a value, which is needed in the remaining evaluation.
<orbifx>
By applying ignore to it (ignore @@ return_xyz ..) you are converting whatever that value was, a record most likely needed for >>= into a plain unit.
<remix2000>
I mean, that I have a chain of functions that do something, but I often don't need to know the results. Compiler complains when I do just `return_something abc;` with `it should return a unit`. That's the 1st case. I use `ignore @@ …` then.
tarptaeya has joined #ocaml
Haudegen has quit [Remote host closed the connection]
tane has joined #ocaml
zpe_ has quit [Remote host closed the connection]
<orbifx>
remix2000: there should be a function `'a t -> () t` for that purpose
<remix2000>
orbifx: isn't ignore that function?
<orbifx>
a specialised ignore for the functor you have.
<orbifx>
It can be, if you know the internals of `>>=` from the functor you are using. Which library is this?
<remix2000>
I "overcomplicated" the problem. I just have `let () = …` which "chains" those functions. Sorry :(
<remix2000>
In other words, it might be just written outside functions.
<orbifx>
Hope you are right. Consider avoiding too many side effects, unless you really intent and mean to do that.
TheLemonMan has joined #ocaml
mengu has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
zpe has joined #ocaml
mengu has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
<orbifx>
companion_cube: here?
<companion_cube>
o/
<orbifx>
yo
<companion_cube>
lo
zpe has quit [Remote host closed the connection]
<orbifx>
so... `Bijection.find_left a bijection`, is a the left value key, or is it the right key with left a correspondence?
<orbifx>
Doing a usability test :P
zpe has joined #ocaml
<companion_cube>
for me find_left means the key is the left key
<companion_cube>
i.e it's left to right
<orbifx>
ok
<orbifx>
so it returns the right-handed value
<companion_cube>
I'd think so
<orbifx>
kk
mengu has quit [Remote host closed the connection]