adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
<hcarty> Drup: Hooray for Lwt-powered Format
<Drup> I'm wondering if we should use a queue or a Lwt_stream
moei has joined #ocaml
<Drup> there is also the delicate issue of flushing
<shon> dmbaturin: in case there was any misunderstanding, most of the tooling I had in mind is completely unrelated to VyConf or ocaml.
<dmbaturin> shon: Which tooling?
shon has quit [Quit: Lost terminal]
NJBS has quit [Quit: Catastrophic failure.]
isd has quit [Ping timeout: 240 seconds]
smondet has joined #ocaml
shon has joined #ocaml
<shon> dmbaturin: Sorry: I think my irssi crashed. I was refering to some comment from awhile back when I mentioned tooling. It's of no concern :)
<dmbaturin> Ah, I see. Well, I hope I'm not using any tools in unusual ways, though _oasis would benefit for some cleanup.
smondet` has joined #ocaml
smondet has quit [Ping timeout: 255 seconds]
<shon> dmbaturin: Not that I've seen! Most of my wheel spinning has been with other projects (in other languages). Getting vyos set up was surprisingly easy, and all of my hurdles with setting up a vyconf development project have been just a matter of learning the rather rich and complex OCaml tooling ecosystem.
<dmbaturin> It's even more important that it's trivial and safe to _upgrade_, and I hope in 2.0 we'll improve it further (upgrades that always need reboot are not nice... especially in telecom).
silver has quit [Read error: Connection reset by peer]
lucybun has joined #ocaml
michbad has joined #ocaml
wtetzner has joined #ocaml
nomicflux has quit [Quit: nomicflux]
snhmib has quit [Ping timeout: 240 seconds]
nomicflux has joined #ocaml
\h has quit [Quit: WeeChat 1.6]
\h has joined #ocaml
nomicflux has quit [Quit: nomicflux]
hunteriam has quit [Quit: Connection closed for inactivity]
xorpse has joined #ocaml
nomicflux has joined #ocaml
nomicflux has quit [Quit: nomicflux]
michbad has quit [Remote host closed the connection]
mfp has quit [Ping timeout: 240 seconds]
tmtwd has quit [Ping timeout: 256 seconds]
copy` has quit [Quit: Connection closed for inactivity]
nomicflux has joined #ocaml
wu_ng has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
wtetzner has quit [Remote host closed the connection]
Algebr has joined #ocaml
xorpse has quit [Ping timeout: 245 seconds]
jlongster has joined #ocaml
jlongster has quit [Client Quit]
hunteriam has joined #ocaml
ryanartecona has joined #ocaml
nomicflux has quit [Quit: nomicflux]
jao has quit [Ping timeout: 240 seconds]
infinity0 has quit [Remote host closed the connection]
ygrek has joined #ocaml
infinity0 has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
ygrek has joined #ocaml
pierpa has quit [Ping timeout: 260 seconds]
MercurialAlchemi has joined #ocaml
hcarty has quit [Ping timeout: 260 seconds]
ygrek has quit [Ping timeout: 248 seconds]
ryanartecona has quit [Quit: ryanartecona]
MercurialAlchemi has quit [Ping timeout: 248 seconds]
atsampson has quit [Ping timeout: 240 seconds]
Guest82 has joined #ocaml
Guest82 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Algebr` has joined #ocaml
Algebr has quit [Ping timeout: 255 seconds]
Algebr` has quit [Remote host closed the connection]
Algebr` has joined #ocaml
MercurialAlchemi has joined #ocaml
polyguy has quit [Ping timeout: 245 seconds]
alfredo has joined #ocaml
hunteriam has quit [Quit: Connection closed for inactivity]
Algebr` has quit [Ping timeout: 256 seconds]
jnavila has joined #ocaml
mengu has joined #ocaml
freusque has quit [Quit: WeeChat 1.6]
<companion_cube> Drup: compatible with normal formatters? neat!!
freusque has joined #ocaml
polyguy has joined #ocaml
larhat has joined #ocaml
AltGr has joined #ocaml
freusque has quit [Ping timeout: 240 seconds]
ocaml476 has joined #ocaml
<ocaml476> Can someone take a look at http://pastebin.com/mCA6zB3y ? I am coding a zipper structure.
<ocaml476> Porting Haskell code to OCaml.
govg has quit [Quit: leaving]
<companion_cube> first, you don't always need to wrap things in a record
<companion_cube> (I mean, it's ok, but a bit more heavy than just `type cell = bool`)
<companion_cube> for the `do` block at the bottom, either you write pattern matches explicitely
<companion_cube> e.g. `match focusListAt x g, focusListAt y line with Some (…), Some (…) -> … GridZipper (…) | None, _ | _, None -> None`
<companion_cube> OR, you can write `>>= : 'a option -> ('a -> 'b option) -> 'b option` and use it
infinity0 has quit [Remote host closed the connection]
polyguy has quit [Ping timeout: 256 seconds]
infinity0 has joined #ocaml
trepta has quit [Ping timeout: 252 seconds]
rwmjones is now known as rwmjones|hols
Simn has quit [Read error: Connection reset by peer]
regnat_ is now known as regnat
Simn has joined #ocaml
LACampbell has joined #ocaml
<LACampbell> ocamls type system is confusing. 'a -> 'a apparently doesn't satisfy 'a -> 'b
<companion_cube> it should
<companion_cube> are you sure that's all there is to it?
polyguy has joined #ocaml
<LACampbell> companion_cube: I am sure I am missing something.
<LACampbell> like if I look at list.map, it's 'a -> 'b, but I can totally map from lists of ths the same type
<def`> LACampbell: you are reading the direction wrong
<def`> you are trying to turn an 'a -> 'a t to 'a -> 'b
<companion_cube> indeed
<companion_cube> array_from : 'a -> 'a Array.t
<ocaml476> Was away
<LACampbell> I don't follow at all
<companion_cube> LACampbell: you're trying to expose too general a type
<companion_cube> `'a -> 'b Array.t` is a very very fishy type
<LACampbell> is the message
<def`> array is invariant (in its parameter :P)
<LACampbell> ok, I'll take your word for it
<LACampbell> that what I am writing is too general
<def`> there is no subtyping relation between a array and b array (unless a = b)
<ocaml476> companion_cube : So for now I use record as I am learning. as long as it works.
<companion_cube> ocaml476: sure :-)
<def`> (it is the "famous" type unsafety builtin java)
<LACampbell> sorry, I really don't get it.
<companion_cube> LACampbell: your signature would allow, for instance: `from_array : bool -> int array`
<LACampbell> I get that it can't be done though
<companion_cube> how would you fill the array?
<LACampbell> idk
<LACampbell> if true then [|1|]
<companion_cube> well, first, you cannot use the argument, so why is it here
<LACampbell> let from_array b = if b then [|1|] else [|0|]
<LACampbell> that would statisfy it
<companion_cube> and what about `from_array : bool -> 'a Array.t`
<companion_cube> how to get a 'a?
<LACampbell> yeah. right
<LACampbell> *sigh* yeah
<companion_cube> ^^
<LACampbell> there's no way to do this. nevermind
ocaml476 has quit [Ping timeout: 260 seconds]
polyguy has quit [Ping timeout: 240 seconds]
ocaml926 has joined #ocaml
<LACampbell> except.. I can do "Deque.create ();;" and get something of type '_a : Deque.t
<Balod> Notice the '_' in '_a
<LACampbell> noticed!
pippijn has quit [*.net *.split]
pippijn has joined #ocaml
<ocaml926> http://pastebin.com/mCA6zB3y Need to know what haskell focusGridAt is doing to understand.
<companion_cube> ocaml926: the `do… <-…` is a monad (here, the Maybe monad, corresponding to `option` in OCaml)
Johann has quit [*.net *.split]
tianon has quit [*.net *.split]
profan has quit [*.net *.split]
unbalancedparen has quit [*.net *.split]
lyxia has quit [*.net *.split]
SIGILL has quit [*.net *.split]
sigjuice has quit [*.net *.split]
bernardofpc has quit [*.net *.split]
emias has quit [*.net *.split]
MasseR has quit [*.net *.split]
profan_ has joined #ocaml
Algebr` has joined #ocaml
bernardofpc has joined #ocaml
<ocaml926> option. Ok
sigjuice has joined #ocaml
tianon has joined #ocaml
SIGILL has joined #ocaml
emias has joined #ocaml
unbalancedparen has joined #ocaml
MasseR has joined #ocaml
lyxia has joined #ocaml
Johann has joined #ocaml
pitastrudl has quit [*.net *.split]
rpcope has quit [*.net *.split]
rpcope has joined #ocaml
Leonidas has quit [*.net *.split]
thegameg has quit [*.net *.split]
rixed has quit [*.net *.split]
Nazral has quit [*.net *.split]
vishesh has quit [*.net *.split]
eagleflo has quit [*.net *.split]
tizoc has quit [*.net *.split]
pote_ has quit [*.net *.split]
metaglog has quit [*.net *.split]
jerith has quit [*.net *.split]
tokenrove has quit [*.net *.split]
trevorriles has quit [*.net *.split]
rixed has joined #ocaml
Leonidas has joined #ocaml
tizoc has joined #ocaml
eagleflo_ has joined #ocaml
jerith has joined #ocaml
trevorriles has joined #ocaml
vishesh has joined #ocaml
Nazral has joined #ocaml
tokenrove has joined #ocaml
pote_ has joined #ocaml
thegameg has joined #ocaml
metaglog has joined #ocaml
pitastrudl has joined #ocaml
caw has quit [Ping timeout: 240 seconds]
ggherdov has quit [Ping timeout: 255 seconds]
Algebr` has quit [Ping timeout: 245 seconds]
ggherdov has joined #ocaml
caw has joined #ocaml
LACampbell has left #ocaml ["WeeChat 1.5"]
ggherdov has quit [Excess Flood]
silver has joined #ocaml
ggherdov has joined #ocaml
snhmib has joined #ocaml
wu_ng has quit [Ping timeout: 260 seconds]
polyguy has joined #ocaml
<Leonidas> iterators in ocaml aka agony :|
<companion_cube> yeah, I might re-open though, with yet another proposal
<companion_cube> but it's really getting on my nerves
<Leonidas> if ocaml had a RFC process like Rust, that'd be amazing
<companion_cube> fragmentation is already settled in too deep for that
<MercurialAlchemi> I wouldn't say ocaml is characterized by an excess of communication and transparency
kakadu has joined #ocaml
<ocaml926> http://pastebin.com/exKXcZGs Does it make sense ?
<companion_cube> yes, except for the crazy indentation :p
<companion_cube> also, the ` should be removed
<ocaml926> It doesn't compile. Must be wrong.
hcarty has joined #ocaml
_andre has joined #ocaml
<companion_cube> the `
<companion_cube> also, read the error messages
<companion_cube> learning to read what OCaml tells you is important :)
<MercurialAlchemi> :q
<companion_cube> :x
<companion_cube> :qa!
hcarty has quit [Ping timeout: 256 seconds]
freusque has joined #ocaml
<ocaml926> http://pastebin.com/YMdV4fSL Now it compiles.
<ocaml926> When None what kind of gridzipper should I create ? Throw exception ?
Algebr` has joined #ocaml
<companion_cube> well, no, just return None (as the Haskell code does)
<companion_cube> (if you write serious ocaml, I'd recommend using ocp-indent for formatting)
Algebr` has quit [Ping timeout: 258 seconds]
<MercurialAlchemi> :xyz
ltadeu has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
<ocaml926> I use emacs ocp-indent. Haven't figured out how to use it :-)
<ocaml926> indent
<ocaml926> Return types don't match.
<ocaml926> if None
freehck has joined #ocaml
infinity0 has quit [Ping timeout: 248 seconds]
infinity0 has joined #ocaml
<reynir> "he future Lwt 3.0.0 will make minor breaking changes near 1 April 2017.", eh why that date
<AltGr> ocaml926‎: if you install opam-user-setup (`opam user-setup install`), it well set ocp-indent up for you
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
mfp has joined #ocaml
mengu has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
<ocaml926> AltGr : Have done. But the default indentation for that code is hard to read. I thought.
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
xorpse has joined #ocaml
snhmib has quit [Ping timeout: 240 seconds]
sepp2k has joined #ocaml
freusque has quit [Quit: WeeChat 1.6]
<haesbaert> where is carcass from topkg distributed /
<haesbaert> ?
<haesbaert> I can't find it
freusque has joined #ocaml
lenticularmother has quit [Read error: Connection reset by peer]
snhmib has joined #ocaml
<larhat> haesbaert: it is not on opam yet, for some reason, but you can git-pin it: opam pin add carcass git://github.com/dbuenzli/carcass.git
<haesbaert> ah thanks
Algebr` has joined #ocaml
snhmib has quit [Ping timeout: 256 seconds]
snhmib has joined #ocaml
Algebr` has quit [Ping timeout: 256 seconds]
groovy2shoes has quit [Quit: Leaving]
atsampson has joined #ocaml
rpip has quit [Ping timeout: 240 seconds]
alfredo has quit [Ping timeout: 248 seconds]
snhmib has quit [Ping timeout: 240 seconds]
lenticularmother has joined #ocaml
snhmib has joined #ocaml
contempt has joined #ocaml
jao has joined #ocaml
xorpse has quit [Ping timeout: 258 seconds]
<AltGr> the code in the pastebin ? Definitely not ocp-indented
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 258 seconds]
<ocaml926> ocp-indent. Does it automatically indent ?
<ocaml926> Maybe it is inactive.
jao has quit [Ping timeout: 240 seconds]
<companion_cube> you need to trigger it somehow
<companion_cube> (sorry, I don't know emacs)
cthuluh has quit [Ping timeout: 258 seconds]
<Drup> companion_cube: it's partially compatible: you can use regular pp functions with %a, but you shouldn't use Lwt_fmt.fprintf to write them
<Drup> which, imho, is good enough
<companion_cube> oh
<companion_cube> why not?
<Drup> well, look at the api ^^'
<companion_cube> I thought it would allocate a local buffer
<Drup> Lwt_fmt.formatter is not equal to Format.formatter
polyguy has left #ocaml ["Leaving"]
<companion_cube> aww
<Drup> but that's ok, it means you just have to write your printers combinators in regular format style, and only use Lwt_fmt as the actual print
<companion_cube> wait, can I use an already existing combinator such as CCFormat.list?
<Drup> yes
<AltGr> Indentation is controlled by your emacs conf, ocp-indent just provides the values. Usually you need to press <tab>, you may want to set 'electric-indent-mode'
<Drup> with %a
cthuluh has joined #ocaml
<companion_cube> ok, so it's fine
<Drup> You can use the traditional format combinators, but you can't write them with Lwt_fmt.(f)printf
<Drup> just that you can't write them with Format.eprintf
<Drup> just as*
<Drup> which, imho, is perfectly acceptable
<companion_cube> yeah, as long as combinators are re-usable it's fine
<companion_cube> this should go into core Lwt, imho
<companion_cube> it's very very useful
<Drup> yes
<Drup> I could also use it to improve Lwt_log
<ocaml926> Is there a Haskell zip equivalent ?
<companion_cube> on lists? List.combine
<ocaml926> zip (repeat i) [0..n-1] | i <- [0..m-1]
<ocaml926> I used to write outer and inner loops but this Haskell seems to do it.
<ocaml926> Maybe this is functional ?
<companion_cube> yes
<companion_cube> in OCaml you're going to have a bit more work
<ocaml926> So I code this in OCaml myself ?
<companion_cube> I'd use some libraries, but if you're learning, it's probably better to do it manually with some recursive functions
wtetzner has joined #ocaml
xorpse has joined #ocaml
<ocaml926> Output of zip (repeat i) [0..n-1] | i <- [0..m-1] is list of lists ?
snhmib has quit [Ping timeout: 240 seconds]
<companion_cube> you should have [ ] around anyway, but yes
wtetzner has quit [Remote host closed the connection]
<aantron> reynir: :D it will be april 6 or later actually
Algebr` has joined #ocaml
ocaml926 has quit [Ping timeout: 260 seconds]
Algebr` has quit [Ping timeout: 258 seconds]
thomasga has joined #ocaml
wtetzner has joined #ocaml
snhmib has joined #ocaml
hcarty has joined #ocaml
hcarty has quit [Ping timeout: 260 seconds]
xorpse has quit [Ping timeout: 240 seconds]
nomicflux has joined #ocaml
snhmib has quit [Read error: Connection reset by peer]
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 258 seconds]
thomasga has quit [Quit: Leaving.]
ryanartecona has joined #ocaml
snhmib has joined #ocaml
sz0 has joined #ocaml
wtetzner has quit [Remote host closed the connection]
thomasga has joined #ocaml
snhmib has quit [Read error: Connection reset by peer]
snhmib has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu_ has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
mengu_ has quit [Read error: Connection reset by peer]
snhmib has quit [Ping timeout: 240 seconds]
thomasga has quit [Quit: Leaving.]
mengu has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
al-damiri has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
pierpa has joined #ocaml
ryanartecona has joined #ocaml
Algebr` has joined #ocaml
lenticularmother has quit [Read error: Connection reset by peer]
wtetzner has joined #ocaml
lenticularmother has joined #ocaml
Algebr` has quit [Ping timeout: 240 seconds]
snhmib has joined #ocaml
wtetzner has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
nomicflux has quit [Quit: nomicflux]
wtetzner has joined #ocaml
snhmib has quit [Read error: Connection reset by peer]
shinnya has joined #ocaml
snhmib has joined #ocaml
hcarty has joined #ocaml
wtetzner has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
rcabaco_ has joined #ocaml
rcabaco has quit [Ping timeout: 240 seconds]
ryanartecona has joined #ocaml
sepp2k has quit [Quit: Leaving.]
nomicflux has joined #ocaml
copy` has joined #ocaml
madroach has joined #ocaml
larhat has quit [Quit: Leaving.]
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 258 seconds]
mfp has quit [Ping timeout: 240 seconds]
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
nomicflux has quit [Quit: nomicflux]
trepta has joined #ocaml
hunteriam has joined #ocaml
mengu has quit [Ping timeout: 258 seconds]
nomicflux has joined #ocaml
pitastrudl has quit [Remote host closed the connection]
pitastrudl has joined #ocaml
AltGr has left #ocaml [#ocaml]
mfp has joined #ocaml
slash^ has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
jnavila has quit [Ping timeout: 240 seconds]
ryanartecona has quit [Quit: ryanartecona]
shinnya has quit [Ping timeout: 240 seconds]
tokenrove has quit [Ping timeout: 260 seconds]
snhmib has quit [Ping timeout: 240 seconds]
Algebr` has joined #ocaml
tokenrove has joined #ocaml
rseymour has quit [Ping timeout: 248 seconds]
Algebr` has quit [Ping timeout: 240 seconds]
rcabaco_ has quit [Ping timeout: 252 seconds]
rseymour has joined #ocaml
ygrek has joined #ocaml
smondet` has quit [Ping timeout: 255 seconds]
Guest26 has joined #ocaml
ryanartecona has joined #ocaml
snhmib has joined #ocaml
nicoo has quit [Ping timeout: 240 seconds]
snhmib has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 240 seconds]
smondet` has joined #ocaml
snhmib has joined #ocaml
nicoo has joined #ocaml
snhmib has quit [Read error: Connection reset by peer]
Algebr`` has joined #ocaml
snhmib has joined #ocaml
kakadu has joined #ocaml
th5 has joined #ocaml
demonimin has quit [Ping timeout: 240 seconds]
soultadu has joined #ocaml
ygrek has joined #ocaml
Algebr`` has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
Algebr`` has joined #ocaml
rcabaco has joined #ocaml
<orbitz> I have a record that is mutable but the access semantics actually make it set-once. Is there a common code pattern to represent this value as covariant/
<orbitz> (that is the + modifier on type variables, right/)
<orbitz> Jane St Async has one trick. Lwt has another crazy trick.
<companion_cube> not that I know of :3
<companion_cube> what's JST's trick?
<orbitz> Obj.magic :)
<orbitz> JST has another type that is invariant and then they Obj.magic between the two
<orbitz> Do Obj.magic's get elided by the compiler?
<companion_cube> heh
<adrien> hmmm
<companion_cube> yes
<adrien> I'm fairly sure this was deemed completely unsafe
<companion_cube> well in this case it should be safe, if you guarantee the write-once
<adrien> and that the runtime might decide to make it crash
<adrien> compiler and runtime*
<companion_cube> adrien: obj.magic is unsafe if you lie about mutability, thins kind of things
<orbitz> Hrm, why would it do that, adrien ?
<companion_cube> I don't think variance is as unsafe
<adrien> yeah, it's the immutability bypass that I had in mind
<Drup> companion_cube: lying about variance is unsafe if it involves mutability too
_andre has quit [Quit: leaving]
<orbitz> I could be wrong about how I understand what they do
<companion_cube> Drup: because of float?
<orbitz> I am under the impression it's safe because a deferred is write-once and the mimmutable
<orbitz> immutable
<Drup> companion_cube: that, and subtyping ...
<companion_cube> what does subtyping have to do with flambda?
<orbitz> I'm not sure what Lwt does. I had a really hard time undrstanding teh Lwt code
<orbitz> Lwt.t has no definition in lwt.ml from what I could grok, I haven't had time to check closer but I'm guessing thet Obj.magic it too
NJBS has joined #ocaml
<companion_cube> I think batteries also has a trick
<companion_cube> based on having two types, one invariant and one covariant
<companion_cube> and a magic conversion from one to the other
<companion_cube> (see BatSplayTree)
<Drup> (yes, lwt uses obj.magic too)
<orbitz> The problem I have is that Cohttp requires its monad to have the type +'a t but all concurrency monad implementation I've found in Ocaml are invariant so this is either a weird restriction or something else
<orbitz> so, is this Obj.magic stuff safe?
<Drup> It depends a lot of what you are doing exactly
soultadu has quit [Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )]
<Drup> also, not sure what you mean, both Lwt.t and Async.t are covariants
soultadu has joined #ocaml
<orbitz> Drup: Yes, but their underlying types are invariant, at least for Async
<orbitz> Async.Deferred.t, at least, is just an Obj.magic of Ivar.t which is invariant.
<orbitz> Async goes through a lot of indirection I don't understand, as well.
<companion_cube> it's because it's the best engineered, obviously
<Drup> Lwt.t might be a bit more imediate
<Drup> (everything is included in lwt.ml)
<orbitz> Lwt.t is even more confusing to me
<Drup> Take your time, the implementation is not that complicated
<Drup> (the fact that it works, though, is a different question)
<companion_cube> otoh, lwt_unix is hard to read :3
<orbitz> the .ml file has no = in the type definition, and it's really unclear to me what I'm suppsoe dto look at to understand what Lwt.t is
<Drup> that's easy: it's a fully abstract datatypes that has, according to the type system, no value.
<Drup> (you can't build any value of that type without some magic)
<orbitz> Right, so what is an Lwt.t when I get one/
<orbitz> I understand it's something, I'm just saying it's unclear based on the code
<Drup> read the rest of the code
sigjuice has quit [*.net *.split]
relrod has quit [*.net *.split]
jnavila has joined #ocaml
sigjuice has joined #ocaml
<orbitz> Yes I looked at it
<orbitz> I'm not saying it's not decipherable, I'm saying it's unclear.
<orbitz> All this for for a +
<Drup> heh, the + is very useful ...
<orbitz> You'd think we'd have a clearer way to express it, if so!
octachron has joined #ocaml
<Drup> Most of the time, it's easy to express
soultadu has quit [Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )]
<orbitz> just not when you have mutability.
<Drup> OCaml's type system happens to be unable to reason about single assignment
<orbitz> Well, really it's change-once-aignment
demonimin has joined #ocaml
<Drup> orbitz: mutability in general is not compatible with covariance, period. You need something that is referentially transparent, and that's something that the compiler will not be able to find, so yes
<Drup> you should lookup value restriction (and it's generalization)
<Drup> there is a RWO chapter on the subject
<orbitz> Yes, I know it's invariant. I'm not asking about that. I'm asking about valid patterns to express single-assignemnt covariant values
<orbitz> So is Obj.magic both safe and not a performance hit for accomplishign this?
<orbitz> I wonder what the cost is to make a concurrency monad immutable...
<Drup> If you are very careful about what you are doing, it can be used safely
<orbitz> And is the safety just that it is single assignmetn/
<Drup> Honestly, if you are not willing to document yourself and study the actual semantics, I'm not sure if I should answer you, because you are going to do something wrong and then complains you are getting segfaults
<Drup> (and I can't really say I can answer most of the time, because obj.magic is really really tricky)
<octachron> Drup, would it not be safer to say that if you have a proof that what are you doing is correct (in stronger type system for instance), then using Obj.magic is safe
<Drup> octachron: that works too :p
<Drup> probably a better way to put it, indeed
<orbitz> Drup: Do you have suggestion on what to read? As far as I can tell a lot of the obj.magic trickery is tribal knowledge.
<Drup> there is a section of RWO about the memory representation of OCaml, that's probably a good start
ltadeu has quit [Remote host closed the connection]
<Drup> (are you trying to write yet another concurency monad ?)
<orbitz> I am for my own use, part of which is pedagogical.
nomicflux has quit [Quit: nomicflux]
<orbitz> And don't worry Drup, you won't be forced to use it against your will. Kicking and screaming.
<Drup> oh, I'm not worried about that
<Drup> if it's for pedagogical purposes, I have no issue what so ever
<orbitz> Drup: I'll rearead it again, but I've read the memory layout section of RWO a few times and I don't recall something relavant to this discussion. I guess I'm more concerned about optimizations. Is the compiler free to cache a value because it doesn't think it's mutable, etc?
<Drup> in the case of lwt, the compiler doesn't know anything about values of type 'a t, since it's a fully abstract type, so it won't do any immutable-based optims
<Drup> (the section about flambda is probably relevant to your interests too)
<orbitz> Ok, Github search cannot find hits for Obj.magic in Lwt, I'll have to peruse the code closer tomorrow.
<companion_cube> might be "%identity" as an external
<orbitz> Yes, I think i read it last pre flambda, I will read that, thanks for the tip on that.
<Drup> the section about flambda is in the official manual
<Drup> and yes, it's %identity with explicit types signatures, in lwt.ml
<orbitz> Are those free?
<orbitz> And how does that compare to Obj.magic/
<orbitz> looks like...the exact same :)
<orbitz> I wish there was a way I could just use the module type system to overlay the "casts". That's probably quite evil.
<orbitz> Drup, companion_cube thank you both for the very helpful information!
<orbitz> Maybe I'll spend a bit seeing how terrible it is to implement an immutable concurrency monad.
<orbitz> Good night.
nomicflux has joined #ocaml
govg has joined #ocaml
myst|fon has quit [Quit: Connection closed for inactivity]
nomicflux has quit [Client Quit]
snhmib has quit [Ping timeout: 256 seconds]
slash^ has quit [Read error: Connection reset by peer]
nomicflux has joined #ocaml
demonimin has quit [Ping timeout: 260 seconds]
kareeeeem has joined #ocaml
<Algebr``> with the change of constructors in 4.04 to be like newtype, does that also mean that say a stub returns a bytes, and the external signature says returns a Foo of bytes, then that will work fine?
AlexRussia has joined #ocaml
relrod_ has joined #ocaml
relrod_ has quit [Changing host]
relrod_ has joined #ocaml
snhmib has joined #ocaml
relrod_ is now known as relrod
demonimin has joined #ocaml
john51 has joined #ocaml
dxtr_ has joined #ocaml
noplamodo has joined #ocaml
noplamodo_ has quit [Ping timeout: 248 seconds]
shakalaka has quit [Ping timeout: 248 seconds]
john51_ has quit [Remote host closed the connection]
dxtr has quit [Read error: Connection reset by peer]
dxtr_ is now known as dxtr
shakalaka_ has joined #ocaml
<hcarty> Algebr``: It requires annotation IIRC
<hcarty> Annotation of the type definition
<octachron> Algebr``, you mean with the unboxed annotation?
hunteriam has quit [Quit: Connection closed for inactivity]
<octachron> Algebr``, since we were speaking of Obj.magic, you can check yourself what happens with "let s: string = Obj.magic (Foo "Hi here!");;" with and without the annotation
<hcarty> I honestly had thought it was this way already - I thought there were discussions about single-constructor variants being optimized away without any special code
<hcarty> But the whole discussion around the unboxed PR makes it seem like that wasn't true
<companion_cube> o/
<hcarty> \o
<hcarty> companion_cube: I'm impressed by (and thankful/hopeful for) your PR patience
<companion_cube> I'm actually not patient :D
<companion_cube> preparing another PR in fact
<companion_cube> I should also try `List.{range,init}`
<cheater> lol
<Drup> octachron: the "inspect" package sounds like a better solution for this kind of things :D
snhmib has quit [Read error: Connection reset by peer]
<Algebr``> octachron: yes, unboxed
<octachron> Drup, sure; but making your toplevel segfaults (or outputs gibberish) if fun from time to time
<companion_cube> https://github.com/ocaml/ocaml/pull/1002 let's go for another round
<Algebr``> octachron: oh clever
wolfcore has quit [Ping timeout: 252 seconds]
<Armael> companion_cube: I just added a thumbs up emoji. With that I'm sure the PR will be merged promptly.
<companion_cube> :D
<companion_cube> ✔
<Algebr``> hmm, doing type f = Foo of bytes [@@ocaml.unboxed] then external g : f -> unit but merlin complains about g
<companion_cube> can't wait for the "party" emoji
<companion_cube> :horray:, I mean
nomicflux has quit [Quit: nomicflux]
wolfcore has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 252 seconds]
smondet` has quit [Ping timeout: 240 seconds]
orbifx has joined #ocaml
<orbifx> hello all
<hcarty> companion_cube: I was going to add that one, but I was worried it would add controvesy to the PR :-)
<companion_cube> :D
ohama has quit [Ping timeout: 258 seconds]
ohama has joined #ocaml
<reynir> wasn't there something special for a variant consisting of a record?
orbifx has quit [Read error: Connection reset by peer]
orbifx has joined #ocaml
snhmib has joined #ocaml
<Algebr``> oh annoyance, you can't do val (foo, bar) = thing () in a class?
<Drup> you can do "let foo, bar = thing () in object ... end"
<Drup> (in the class definition)
<Algebr``> what again is the difference between that and val ?
<Drup> val declares a field, this is just computation
<Algebr``> right, so this will go off even if no one creates the object?
<Drup> no, it will be executed when you use the constructor
<Algebr``> why was this distinction made
<Drup> this means you can use (part of) the regular language of expression to do arbitrary computations before creating the object
nomicflux has joined #ocaml
nomicflux has quit [Quit: nomicflux]
<Algebr``> oh great, lol Fatal error: exception Invalid_argument("Gc.finalise")
jnavila has quit [Quit: Konversation terminated!]
ryanartecona has joined #ocaml
larhat has joined #ocaml
orbifx has quit [Read error: Connection reset by peer]
orbifx has joined #ocaml
demonimin has quit [Ping timeout: 240 seconds]
wtetzner has joined #ocaml
<octachron> companion_cube, what does "Seq.tors" mean ?
Guest26 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<copy`> Looks like s/Iter./Seq./
lenticularmother has quit [K-Lined]
kakadu has quit [Remote host closed the connection]
th5 has quit [Remote host closed the connection]
<hcarty> octachron: I'm sounds like a play on ctors
<hcarty> s/I'm //
govg has quit [Ping timeout: 248 seconds]
rpip has joined #ocaml
Sorella has joined #ocaml
al-damiri has quit [Ping timeout: 240 seconds]
NhanH has quit [Ping timeout: 240 seconds]
Sorella has quit [Ping timeout: 255 seconds]
bigs_ has quit [Ping timeout: 256 seconds]
nomicflux has joined #ocaml
al-damiri has joined #ocaml
Sorella has joined #ocaml
NhanH has joined #ocaml
Denommus has joined #ocaml
Denommus has quit [Client Quit]
Denommus has joined #ocaml
lambda_foo has joined #ocaml
larhat has quit [Quit: Leaving.]
snhmib has quit [Ping timeout: 255 seconds]
govg has joined #ocaml
snhmib has joined #ocaml
orbifx has quit [Quit: WeeChat 1.6]
octachron has quit [Quit: Leaving]
snhmib has quit [Ping timeout: 248 seconds]