wraithgar has quit [Quit: This computer has gone to sleep]
wraithgar has joined #elliottcable
wraithgar has quit [Client Quit]
alva_ is now known as alva
<incomprehensibly>
pikajude:
<ljharb>
link?
<incomprehensibly>
ljharb: fast.com apparently
<ljharb>
mine says 120mbps
<ljharb>
130 now
<ljharb>
yay
devyn has quit [Ping timeout: 260 seconds]
devyn has joined #elliottcable
devyn has quit [Ping timeout: 260 seconds]
devyn has joined #elliottcable
thealphanerd has quit [Quit: farewell for now]
thealphanerd has joined #elliottcable
eligrey has quit [Ping timeout: 250 seconds]
prophile has quit [Ping timeout: 276 seconds]
prophile has joined #elliottcable
prophile has quit [Ping timeout: 250 seconds]
prophile has joined #elliottcable
Sgeo has quit [Ping timeout: 240 seconds]
jane has quit [Ping timeout: 246 seconds]
jane has joined #elliottcable
wraithgar has joined #elliottcable
jane has quit [Changing host]
jane has joined #elliottcable
<pikajude>
lol
<purr>
LOLNOPE
<pikajude>
on FOS: "Manage My Domains" and then one item below it: "Manage Your Hosting"
<pikajude>
who are you talking about, dropdown menu?
<pikajude>
who are you talking about, dropdown
<pikajude>
FUCK
<pikajude>
jesus christ
<pikajude>
i feel like every time I accidentally press up to go through my message history
<pikajude>
there are like 19 keyboard combinations that will send the message
<pikajude>
i think that one was like, Ctrl-N
<pikajude>
foo
<pikajude>
no, Ctrl-M
<pikajude>
I don't want to send the same message twice, i just want to delet it plz
<pikajude>
holy shit i cannot FUCKING STAND node.js
<pikajude>
this is the first time i've written actual code in awhile
<pikajude>
this is the ONLY LANGUAGE where your code will fail because you didn't insert the "go to the next line" line
<pikajude>
except for fucking basic
<pikajude>
WHO THOUGHT THIS WAS A GOOD IDEA
<ljharb>
lol the what?
<purr>
trololol
<ljharb>
what are you talking about
Sorella has joined #elliottcable
<incomprehensibly>
hi Sorella
<incomprehensibly>
(i'm @glowcoil haha)
<Sorella>
incomprehensibly: 'lo
<incomprehensibly>
Sorella: you're the person i just replied to on twitter, right? just making sure i'm remembering names right
<Sorella>
incomprehensibly: yeah, I'm robotlolita on Twitter
<purr>
trololol
<pikajude>
ljharb: i speak, of course, of manual callbacks
<ljharb>
well yeah, use promises, silly
<pikajude>
i would but i don't understand why promises eat exceptions
<ljharb>
they don't eat them. they nicely contain them in a box.
<pikajude>
uh huh
<ljharb>
just always stick a .catch on every promise chain
<pikajude>
ok
<incomprehensibly>
robotlolita
<incomprehensibly>
aww purr caught it as a lol before
<ljharb>
altho soon it's likely that node will crash-by-default when an unhandled rejected promise is GCed
<pikajude>
will that be in version 7
<incomprehensibly>
purr: :(
<ljharb>
pikajude: hopefully
<Sorella>
Oh
<pikajude>
ok
* pikajude
puts his harp down
<pikajude>
deep breaths
<ljharb>
it'll be ok, i … promise
<Sorella>
Working with promises in Node is not very different from working with IO monads in Haskell, really. Except for the part where it's much simpler.
<pikajude>
i don't even understand that sentence
<Sorella>
(For some reason I expected people in this channel would know Haskell, I guess)
<incomprehensibly>
promises do support a monad interface ;o
<incomprehensibly>
Sorella: I am a Haskell pal
<pikajude>
i know haskell
<pikajude>
i don't have any idea what promises have to do with (presumably) do notation
<incomprehensibly>
pikajude: not do notation
<incomprehensibly>
specifically
<Sorella>
But what I mean to say is that promises reify the errors and successes in a way that you can distinguish between them. And at that point, instead of a sequence of actions that all return nothing, like: `doX(); doY(); doZ()`, you explicitly state the dependencies between each of those expressions, so `;` becomes `.then()` (which would be >>= in Haskell)
<Sorella>
They could. But they're not in JS. They're just similar.
<Sorella>
(Since `.then()` violates the monad laws)
<pikajude>
lol
<purr>
lolol
<pikajude>
so Promise is like Monad
<pikajude>
not like IO
<incomprehensibly>
Sorella: oh, how specifically does it
<incomprehensibly>
pikajude: well no Promise is a type that implements something like Monad
<pikajude>
well Sorella said Promise exists for operation sequencing
<pikajude>
which is what Monad is for
<Sorella>
incomprehensibly: `Promise<A>.then(f: A => B) => Promise<B>`, would be map, `Promise<A>.then(f: A => Promise<B>) => Promise<B>` would be flatMap or >>=, but you can't choose between them, and additionally .then will assimilate anything with a .then method, and recursively `join` that value until it gets a B.
<Sorella>
So you can't have `Promise<Promise<A>>`
<incomprehensibly>
Sorella: ah right
<incomprehensibly>
just automatically flattens for ya
<Sorella>
This does make working with promises simpler for the common cases, but makes it less useful as a general abstraction. Since JS doesn't need to put all effects into something like Monad, this turns out to be pretty okay (and you never run in problems like needing MTL)
<incomprehensibly>
mhm
<Sorella>
pikajude: yeah, when I said they were similar to the IO monad, I was more of tracing a parallel between how you structure your program in terms of promises (where the top level is generally a value of type `Promise`), and the way you structure your programs in terms of the IO monad in haskell (where the top level has type `IO ()`)
<Sorella>
And that way you can't really "miss" errors, because at the top level, `.catch(error => handleTopLevelErrorHere)` will get any error propagated from your application, unless you're ignoring them somewhere.
<Sorella>
(I hope that makes sense? I'm not sure it's very well explained there :'))
<pikajude>
brb, gonna check whether the caterer got here yet
<pikajude>
they're 90 minutes late
<incomprehensibly>
I think it's misleading to say monads are for operation sequencing
<incomprehensibly>
the IO type is for IO-operation sequencing
<pikajude>
but that's what monads are for in general
<incomprehensibly>
well no
<pikajude>
at least in haskell
<incomprehensibly>
the list monad doesn't fit that at all
<pikajude>
it does though
<incomprehensibly>
or maybe
<incomprehensibly>
like, it fits that exactly as well as fmap does
<incomprehensibly>
and comonads
<incomprehensibly>
and function compose
<pikajude>
no i'm talking about bind
<pikajude>
anyway brb
<incomprehensibly>
bind is like, a special fmap that gives you extra power
<incomprehensibly>
to manipulate a bit of the structure as well as the values "inside" the structure
<incomprehensibly>
monads aren't about "sequencing" because you can sequence like this: b = f a; c = g b; d = h c
<incomprehensibly>
and also like this: b = fmap f a; c = fmap g b; d = fmap h c
<incomprehensibly>
in the first case, f :: A -> B etc. and in the second case f :: F A -> F B etc.
<incomprehensibly>
wait sorry lol f :: A -> B but a is F A
<purr>
loling
<incomprehensibly>
purr: there you are
<pikajude>
fair
<pikajude>
ok
<pikajude>
i misspoke
* incomprehensibly
shrug
<incomprehensibly>
pikajude: lol sorry to bite your head off about something trivial and kind of debatable
<pikajude>
Monads are for when you have a type for which you can implement the functions bind :: m a -> (a -> m b) -> m b and join :: m (m a) -> m a and which follows a certain set of rules
<pikajude>
so as you can see here it is analogous to Promise
<incomprehensibly>
<pikajude>
you know i wouldn't mind missing callbacks so much if at least i could pause the debugger when they happen
<pikajude>
but context is sorta something you have to let go of when debugging node
<pikajude>
unfortunately that slows me down as a developer
<incomprehensibly>
<anonymous function>
<pikajude>
this is almost as disappointing as that really suspect sushi the caterers brought
<incomprehensibly>
pikajude: where are you getting catered to
<pikajude>
work
<incomprehensibly>
are you doing node @ work
<Sorella>
pikajude: async/await introduces resumable functions, which is pretty neat
<pikajude>
i am doing node at work
<Sorella>
It builds on top of promises though, and it has some... uh, sad limitations
<jfhbrook>
like which Sorella
<Sorella>
jfhbrook: you can't force a value out of a promise (like you can in C#), and async/await doesn't cross function boundaries, so you can't do something like: `async foo(xs){ xs.forEach(x => await f(x)) }`.
<jfhbrook>
you're right about the cross function boundary though, that does kinda suck
<ljharb>
generators are pauseable/resumable functions too
<jfhbrook>
generators are neat
<ljharb>
anyways `async function` is awesome. but `await` i think will rarely be useful, since most people don't have a single serial pipeline in their dependency chain
<jfhbrook>
though I bet they suffer from a similar problem in that particular case
<ljharb>
meh, generators are overblown. very very few things are nicer with generators than without.
<ljharb>
imo
<jfhbrook>
I mean
<jfhbrook>
I haven't found a use for them yet outside of demonstrating them with a fibbs generator that, well
<jfhbrook>
it doesn't end so it's really easy to lock up my interpreter ;D
<Sorella>
jfhbrook: i.e.: I can't do `var myValue = someFunctionThatReturnsAPromise().getTheValue()`
<Sorella>
And have `myValue` be the value inside of that promise, not wrapped in anything
<jfhbrook>
can't you do var myValue = await someFunctionThatReturnsAPromise() though?
<Sorella>
jfhbrook: sure, but then you need to make your function asynchronous too
<ljharb>
which means that the "await" unwraps on the next turn after the promise resolves
<Sorella>
You can't choose to synchronously await a value
<ljharb>
ie, unless you're doing await in a loop, async/await is purely sugar over nested promise .then's
<Sorella>
(Which is good, and is bad. Depending on the situation)
<ljharb>
it's only sugar over generators with a loop (or similar constructs that make it require a state machine)
<Sorella>
I use `await` a lot because it makes code easier to follow. But it's easy to misuse as well
<jfhbrook>
is let [foo, bar] = await Promise.all([getFoo, getBar]) a thing you can do?
<ljharb>
Sorella: i've yet to see common JS use cases where `await` is actually much of an improvement
<ljharb>
jfhbrook: yes
<jfhbrook>
I don't remember how destructuring works
<ljharb>
well almost
<ljharb>
getFoo and getBar would have to be invoked
<jfhbrook>
but you can see sarah palin's house from it
<ljharb>
delightful
<jfhbrook>
indeed!
<jfhbrook>
you can see why I'm conflicted
<jfhbrook>
well and also the whole "can no longer get a good local tech job" thing, but y'know
<ljharb>
you can get $2K/year just for being there
<jfhbrook>
not anymore
<ljharb>
in return you get giant mosquitos
<ljharb>
wait what?
<jfhbrook>
oil totally shit the bed
<ljharb>
they stopped paying people to live in alaska?
<jfhbrook>
sort of
<ljharb>
so without an oil industry isn't that *more* of a reason to pay people to come to alaska?
<jfhbrook>
without an oil industry there isn't any money with which to bribe people with
<jfhbrook>
more importantly, there isn't enough money to run the government
<jfhbrook>
the state government is freaking the fuck out right now, cutting the university system to the point of crippling it, instituting income taxes, ditching the dividend
<jfhbrook>
they need to remove oil subsidies too but that's obviously a whole thing
<ljharb>
sure, that'd be too obvious
<jfhbrook>
well all those things are on the table, and then some
<jfhbrook>
and because of republicans, they just aren't willing to do the hard stuff that needs to be done
<jfhbrook>
AK has a 4 billion rainy day fund, they're looking at using half of that this year even with ultra-austerity
<ljharb>
it's ok, there won't be as many rainy days due to global warming
<jfhbrook>
oh man ljharb with the way global warming's affecting the arctic that isn't even funny anymore
<jfhbrook>
like, polar bears are probably going extinct in our lifetime kinda bad
<ljharb>
◉︵◉
<pikajude>
that sucks
<jfhbrook>
yeah
<jfhbrook>
and alaskans are in total denial because oil does that to a person
<jfhbrook>
anyways, for me the important thing is that for the first time in my life I'm realizing I can afford permanent housing