adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
porchetta has quit [Ping timeout: 260 seconds]
oturtle has quit [Ping timeout: 260 seconds]
porchetta has joined #ocaml
porchetta has quit [Ping timeout: 258 seconds]
porchetta has joined #ocaml
oturtle has joined #ocaml
jbrown has quit [Ping timeout: 272 seconds]
jmagnusj has quit [Quit: Leaving]
olle has quit [Ping timeout: 258 seconds]
olle has joined #ocaml
smazga has joined #ocaml
dborisog_ has joined #ocaml
kvda has joined #ocaml
mfp has quit [Ping timeout: 264 seconds]
pierpa has quit [Remote host closed the connection]
jao has quit [Ping timeout: 260 seconds]
wingsorc has joined #ocaml
wingsorc has quit [Quit: Leaving]
waleee-cl has quit [Quit: Connection closed for inactivity]
mbuf has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
narimiran has joined #ocaml
sgnb` has quit [Remote host closed the connection]
nicoo has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
ggole has joined #ocaml
kvda has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nullcone has joined #ocaml
chripell has joined #ocaml
ggole has quit [Remote host closed the connection]
ggole has joined #ocaml
dborisog_ has quit [Ping timeout: 240 seconds]
ArthurStrong has joined #ocaml
copy has quit [Ping timeout: 246 seconds]
<Leonidas> olle: `return`? As in a statement?
olle_ has joined #ocaml
ollehar_ has joined #ocaml
ggole has quit [Quit: Leaving]
ollehar_ has quit [Ping timeout: 258 seconds]
olle_ has quit [Ping timeout: 246 seconds]
olle_ has joined #ocaml
ollehar has joined #ocaml
dborisog_ has joined #ocaml
jbrown has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
bartholin has quit [Ping timeout: 258 seconds]
bartholin has joined #ocaml
<olle_> monadic return syntax, like let* ?
<Armael> what would the syntax be?
<def> return :P
<Armael> yeah :)
<olle_> well, now it's return ()
<olle_> hm
<olle_> hard to make that shorter I admit
<Armael> and it's just a normal function call, so no need for special syntax
<olle_> booo
raver has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
<Leonidas> `pure ()`
<Leonidas> saved 2 characters
<olle_> `()`
<olle_> `_`
<olle_> `:D`
clockish has quit [Ping timeout: 260 seconds]
copy has joined #ocaml
<dborisog_> Do you know any good I/O or (basic) ETL library dealing with ADT <--> relational schema? I would imagine a star schema for a record-of-variants ADT.
<Serpent7776> Is there `<-` assignment operator in ocaml? This page says there is https://en.wikipedia.org/wiki/Assignment_(computer_science)
smazga has joined #ocaml
<theblatte> <- is for mutating record fields
<theblatte> type t = { mutable n : int } let x = { n= 4 } in x.n <- 5; x.n
<Serpent7776> Is that part of the language? Because When I try `(<-);;` in utop it says syntax error
<theblatte> yes, just like (:=) will be a syntax error
<theblatte> it's just not defined as an infix binary function
<theblatte> well, I said that, but I'm wrong about (:=) ;)
<theblatte> (:=);;
<theblatte> - : 'a ref -> 'a -> unit = <fun>
<Serpent7776> ok, thanks :)
<theblatte> <- needs to operate on a field name though, which is not a valid OCaml value in itself, hence why it's not defined like that
<Serpent7776> yeah, when I try `let x = 1; x <- 1` I got 'Error: The value x is not an instance variable'
Anarchos has joined #ocaml
clockish has joined #ocaml
raver has joined #ocaml
<octachron> You can only mutate mutable fields of records (and mutable instance variable in classes). If you are learning OCaml, you should consider that every values is immutable at first.
<Anarchos> octachron i wonder why record fiels have been made mutable and no other types of values
<def> because values are immutable, and record fields are not values.
<Anarchos> what are they ?
<def> fields?
<octachron> named offset in a memory block?
<Anarchos> indeed i wonder why the ocaml decided to render only fields of record ad instance variabeles mutable
<theblatte> also references
<theblatte> (which are implemented as a mutable record field if I'm not mistaken)
<Leonidas> theblatte: yeah, a ref is just a record with a mutable field, so it is purely syntactic sugar
<theblatte> can you access the field? what's it called?
<octachron> It is not even a syntactic sugar? `ref` is defined in the `Stdlib` module as an ordinary record.
<octachron> contents
<theblatte> you're right octachron, haha
<flux1> I guess it would bring interesting things to think about, such as how pattern matching works, if values were mutable
<flux1> you can of course pattern match a record, but then the binding is not mutable. should it be if the record field is mutable?
<flux1> I think it should be the other way around (no mutable at all, only primitive "ref"), but in practice it can be nice at times, when copying records
<flux1> ..and of course, performance
<zozozo> flux1: well, problems can arise if you pattern match a record (or something else that contain mutable parts), and also mutate it inside of a 'when' guard
<zozozo> but mutating things in when guards when patter matching on them is more seen as a user error (reasonably, ^^)
<zozozo> but, some other subtle operations allowed in patterns can have side-effects not visible to the user (i.e. pattern matching a float array, a lazy value, etc...)
Haudegen has joined #ocaml
<zozozo> which interacts more or less well with the assumption of the pattern matching engine that *values* (so not mutable things) are pattern matched
<Leonidas> zozozo: if someone submits me code where a guard starts mutating shit I'd get furious
<zozozo> Leonidas: agreed
<zozozo> that would juste be bad code
<zozozo> but it's tecnically possible, and I don't recall the exact situatio of the compiler wrt to that currently (it might potentially cause segfaults in some cases I guess)
<Anarchos> I build a bytecode with dune but ocamldebug crashes on it
zebrag has joined #ocaml
inkbottle has quit [Ping timeout: 246 seconds]
<flux1> zozozo, it probably isn't a problem for compiler, because it doesn't do coverage analysis for 'when'
<flux1> it's only a problem for the poor sap who needs to debug it :)
<flux1> and, shortly after, to the person who wrote it
<octachron> There is a bug when mixing lazy and matching on mutable fields: https://github.com/ocaml/ocaml/issues/7241
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
ArthurStrong has quit [Ping timeout: 272 seconds]
zatumil has joined #ocaml
waleee-cl has joined #ocaml
peterbb has quit [Quit: peterbb]
FreeBirdLjj has joined #ocaml
Boarders__ has quit []
<olle_> booo
<olle_> buuug
Boarders__ has joined #ocaml
Boarders__ has quit [Client Quit]
Boarders has joined #ocaml
<companion_cube> Leonidas: mutation isn't necessarily bad
<companion_cube> even in a functional context, you can have caching or hashconsing of stuff
<companion_cube> which is technically mutation
<companion_cube> (but yeah, if it's in a guard, it should probably be idempotent)
Haudegen has quit [Quit: Bin weg.]
wingsorc has joined #ocaml
tane has joined #ocaml
jao has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
narimiran has quit [Ping timeout: 264 seconds]
FreeBirdLjj has joined #ocaml
olle_ has quit [Ping timeout: 272 seconds]
olle_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 272 seconds]
olle_ has quit [Ping timeout: 246 seconds]
ollehar has quit [Ping timeout: 272 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
Haudegen has joined #ocaml
Anarchos has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Anarchos has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 256 seconds]
sagax has quit [Ping timeout: 256 seconds]
oturtle has quit [Ping timeout: 265 seconds]
webshinra has joined #ocaml
jnavila has joined #ocaml
oturtle has joined #ocaml
schlaftier has quit [Read error: Connection reset by peer]
schlaftier has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
FreeBirdLjj has joined #ocaml
smazga has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
smazga has quit [Ping timeout: 258 seconds]
smazga has joined #ocaml
schlaftier has quit [Quit: The Lounge - https://thelounge.chat]
schlaftier has joined #ocaml
dborisog_ has quit [Ping timeout: 256 seconds]
chripell has quit [Ping timeout: 256 seconds]
<flux1> holy consistency, batman :) (preprocess (pps lwt_ppx sedlex.ppx ppx_deriving_yojson lens.ppx_deriving))
<companion_cube> :D
<flux1> sadly lens.ppx_deriving doesn't seem to work with the driver dune uses
peterbb has joined #ocaml
narimiran has joined #ocaml
smazga has quit [Quit: leaving]
Haudegen has quit [Read error: Connection reset by peer]
zatumil has quit [Ping timeout: 264 seconds]
Haudegen has joined #ocaml
mbuf has quit [Quit: Leaving]
Haudegen has quit [Ping timeout: 258 seconds]
Haudegen has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 258 seconds]
narimiran has quit [Ping timeout: 272 seconds]
<olle> inside lwt, what's the difference between `return ()` and just `()`?
<olle> looking at the websocket example server
<olle> PongFrame -> return ()
<olle> but
<olle> CloseFrame -> channel#write_close_frame
<olle> that's it
<olle> ah, maybe write_close_frame already returns `unit Lwt.t`
<olle> yes
<olle> problem solved
<olle> is there a better syntax for let*, when let* _ =
<olle> that is, we don't care about the variable
<olle> or it's unit
<olle> i believe in haskell it's just written as an imperative statement? because it's all wrapped in the do-notation
Anarchos has quit [Ping timeout: 260 seconds]
jnavila has quit [Quit: Konversation terminated!]
peterbb has quit [Quit: peterbb]
vicfred_ has joined #ocaml
<olle> let (;) = >>= fun() ->
<olle> ...
<olle> let;
<olle> ?
<olle> ;*
<olle> ?
tobiasBora has quit [Ping timeout: 240 seconds]
<olle> also looks like a kiss!
vicfred has quit [Ping timeout: 265 seconds]
tobiasBora has joined #ocaml
FreeBirdLjj has joined #ocaml
vicfred_ has quit [Quit: Leaving]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
vicfred has joined #ocaml
Hrundi_V_Bakshi has joined #ocaml
vicfred has quit [Remote host closed the connection]
vicfred has joined #ocaml
tane has quit [Quit: Leaving]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
Anarchos has quit [Ping timeout: 258 seconds]
ArthurStrong has joined #ocaml
kvda has joined #ocaml
sagax has joined #ocaml