ec changed the topic of #elliottcable to: a π•―π–Šπ–“ 𝖔𝖋 π•―π–Šπ–™π–Šπ–—π–’π–Žπ–“π–Šπ–‰ π•―π–†π–’π–˜π–Šπ–‘π–˜ slash sΝ”ΜžuΝ•Ν™pΝ™Ν“e̜̺rΜΌΜ¦i̼̜oΜ–Μ¬rΜ™Μ™ c̝͉α»₯Μ§Ν˜αΈ·Μ‘Ν™Ε£Ν“Μ€ || #ELLIOTTCABLE is not about ELLIOTTCABLE
danpalmer has joined #elliottcable
danpalmer has quit [Quit: Connection closed for inactivity]
<ec> oh shit Determinist! lmao
<ec> found him on Twitter, but he hasn't tweeted in aaaaaages. oh well. :P
<ec> anyway it's got async/await as of a week ago soooo
<ec> or rather, syntactic monadic-bind support which is basically the same thing w/ LWT
<pikajude> i love monads
<jfhbrook> no exceptions tho yeah?
<ec> huh?
<jfhbrook> I assume syntactic monadic-bind support is similar to haskell do blocks or scala for comprehensions
<jfhbrook> and w/ for comprehensions you can def use them to "unpack" Futures and it's great, but
<ec> I know neither, so I can't speak to it!
<jfhbrook> async/await in javascript/python at least will raise/throw exceptions encapsulated by any awaited awaitables
<jfhbrook> while scala for comprehensions aren't really aware of the error states
<jfhbrook> you have to .catch "manually"
<cloudhead> ec: how's it going
<cloudhead> are you writing SML now?
<ec> OCaml, BuckleScript
<ec> cloudhead: omg hi how's life
<ec> sorry was in a meeting
<ec> aaaaaand now I'm gonna go set up a WX 9100 eGPU so I can sell my ancient Mac Pro O_O
<cloudhead> hey :)
<cloudhead> BuckleScript :o
<cloudhead> you have a mac pro still?
<cloudhead> that is pretty ancient
<pikajude> is it a garbage can?
<ec> yeah it's v ancient
<ec> time to sell before it's *utterly* worthless lmao
<ec> holy shit this works1
<ec> wow
<ec> tried to do eGPU for VR a couple of years ago and it was a shiiiiiiitshow
<ec> nearly bricked my laptop
<ec> now it's literally plug-n-play. magical.
<jfhbrook> I think I remember that
<jfhbrook> what is bucklescript
<ec> ML β†’ JS compiler, basically
<ec> with a lot of very good design decisions β€” it's very npm- or react-centric; way more focused on being Good For Real-World JS than anything else
<jfhbrook> πŸ€”
<ec> it's unfortunately very young and underfunded, though; basically one guy. still got a lot of UX bugs. I've been using it pretty heavily, for a lot of stuff it Maybe Wasn't Designed For, and definitely causing it to constantly get in my way.
<ec> oh uh ReasonML == BuckleScript, if you've heard of that instead?
<jfhbrook> I've heard of people mention reason yeah
<jfhbrook> dunno it but have heard of it
<ec> anyway it's vfcool
<ec> as for monadic bind β€” I dunno! I haven't built OCaml off of master or played with it, so I've no idea how it deals with exceptions
<ec> it's not a big change, just a minor syntactic one, so I'm pretty sure the answer is β€œhow it always has.”
<ec> I don't use promises Like A Lot; so educate me on why you need `.catch` and/or what's missing in Scala? (=
<jfhbrook> uhhhhh
<jfhbrook> so a Promise in javascript is a Promise[Error, Any], right? and if you have a Promise you can call .then(Any => Any) to access the inner value and return a new Promise
<jfhbrook> if that function ever raises an Error
<jfhbrook> then the Promise is in an error state, and the .then doesn't execute, you just get a promise w/ the same internal values back
<jfhbrook> but if you call .catch(Error => Any), that will give you the Promise's error state, and you can return a new value
<jfhbrook> note that for js, if you return a Promise inside one of those handlers it gets flattened
<jfhbrook> so in javascript you might have something like
<jfhbrook> doAsyncThing().then(deal_with_result).catch(deal_with_error)
<jfhbrook> or, .then(deal_with_result, deal_with_error) as it turns out
<jfhbrook> w/ async/await during "unpacking" it'll raise the error so you can instead write something like (and keep in mind this isn't quite the same as either thing I wrote down:
<jfhbrook> try { const result = doAsyncThing(); } catch (err) { deal_with_error(err); } deal_with_result(result);
<jfhbrook> like that's obviously bad code but you get the idea
<jfhbrook> meanwhile, in scala, you have for comprehensions where .then is spelled "->" but exceptions aren't dealt w/
<jfhbrook> so you might write, say,
<jfhbrook> val result = for { r <- doAsyncThing() } yield deal_with_result(result);
<jfhbrook> as it turns out I'm preeeeeeetty sure that Futures in scala don't encapsulate errors so you'd actually have to do something like with a Try, so a Promise[Try[Something]] and then something like for { t <- doAsyncThing() } yield t match { case Success(v) => dealWithResult(v) case Failure(err) => deal_with_error(err) }
<jfhbrook> and, uh, a bunch of functional tools I'm not good at
<ec> reading
<ec> I'm preeeeeeetty sure that's easily implemented in user space tho, so I'm confused
<ec> sorry trine unpack this in my head