Her: "As you all presumably know, a monad is" Me: "A monoid in the category of endofunctors!" Her: "A container or wrapper that abstracts away execution concerns" Me: "That makes a bit more sense than the thing I learned to parrot, but no I actually don't know what a monad is."
@DF-ss5ep2 жыл бұрын
It's a wrapper and you can merge a bunch of wrappers in any order.
@gabedamien2 жыл бұрын
@@DF-ss5ep mmmm, it depends on exactly what you mean. For example that description arguably is more specific to semigroups and monoids than for monads. There is an associative operation for monads, namely, kleisli composition, but it's not how we always think about monads practically speaking.
@danchatka86132 жыл бұрын
Excellent presenter. Would love to hear this same presenter discussing the topic next year, to find out if it worked as well as planned. Elaborate optimization frameworks can take on a life of their own, have unexpected side-effects, and become unmaintainable. Ideally, if the framework is successful long-term, it would become the basis of an open source library with a wider support base.
@batlin2 жыл бұрын
Drowning in clever Scala cats/cats-effect/akka/etc code was one reason I left my old job. I like learning and languages, but our velocity sucked because only one extremely nerdy genius on our team was comfortable and productive working with that codebase.
@vsams142 жыл бұрын
This is extremely pertinent to my work and I greatly appreciate this presentation!
@codeasone2 жыл бұрын
Looks like it will make developer's lives a lot nicer. Great talk, so many good talks at Strange Loop this year.
@ernesto87382 жыл бұрын
feels very erlang BEAM
@udadog2 жыл бұрын
Been enjoying using Elixir since it runs on the beam. It was all because I was really interested in concurrency when my professor had me make a multi tcp chat server. Went from Python as the start, to Go, then finally to Elixir.
@theteachr2 жыл бұрын
Seems like we keep forgetting the great ideas and keep reinventing them.
@7th_CAV_Trooper2 жыл бұрын
Glad I stayed to the end. Very cool solution.
@mikhailfranco2 жыл бұрын
Virding's First Rule of Programming: _Any sufficiently complicated concurrent program in another language_ _contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang._
@zyansheep2 жыл бұрын
How does this compare to algebraic effects?
@capability-snob Жыл бұрын
I really like this. Few people seem to understand that in order to safely ignore concurrency boundaries, you need to verify RT. I honestly watched this expecting to see another bad coroutine library, rife with "stale stack frame" bugs, but this is well thought out.
@gdargdar912 жыл бұрын
If you want parallelism, use applicatives not monads. Monads are sequential by nature. Haskell automatically switches to applicatives when it sees you don’t use the binding. So monads are not the problem here, Scala is.
@rikamayhem2 жыл бұрын
Isn't applicative-do a language option disabled by default, though? How many people really use it?
@flight_risk2 жыл бұрын
so let me get this straight we should adopt category theoretic abstractions as a clearer and more concise way to express our applications because… nobody except GHC contributors knows how to use them ’correctly.’ if they did, they would simply implement their compiler to branch on how they are invoked, and therefore ‘monads in production have never been tried.’ on a completely unrelated note, have you ever wondered why there are not a great many haskell developers?
@paulpinecone24642 жыл бұрын
Have you in fact invented macros where it wraps your code with the necessary machinery for concurrency without us having to see it? Also since we are teaching people to favor transparency would it be preferable to assume @node and instead mark anything nontransparent with @unsafe?
@virkony2 жыл бұрын
Thank you for a great talk. I like topics brought in here. And it is interesting idea to sort of auto-lifting normal types to hide more complex ones behind pre-processor triggered by @node. If I understood correctly, difference from various async keywords of languages is that it fuses deeply with types rather than simply wrapping in Future[T]. But isn't it basically adding yet another axis of types? E.g. Mercury language having "insts" alongside with types that bascially allows both split types further (e.g. non-empty list) and to model some stuff that is not covered by types. BTW, Haskell code by itself also parallelizable and cachable without invading types, which allows parallel library to have "using :: a -> Strategy a -> a". And promise given when marking something with @node probably can be compared to unsafeInterleaveIO. But downside is that this might easily push development to practice "tweak and check actual code/behavior it produces" due to sometimes unexpected behavior for devs. I had impression that this is something that no longer considered as a feature and that's why libraries like conduit/iteratee/pipes gain more control over resources use. Curious about how it is being balanced between being too generic with low control and a lot of places to tune (e.g. caches) to get it right. Are there any interesting auto-tuning and/or auto-learning work cost that keeps decisions about batching vs latency and competing caches?
@U1F9842 жыл бұрын
Great talk. I wonder about the example with the cached author though; what happens if the business logic writes something to the data store? Will it see its own writes?
@EvincarOfAutumn2 жыл бұрын
I’ve worked on a similar system (Haxl) in Haskell. We allowed writes, but by default, the effect of the write would not be visible to subsequent reads within the same transaction. In order to _entirely_ prevent observable side effects, you would need to either ban writes or ensure that your read queries don’t overlap-for example: “load XY, store Y, load YZ” could observe that Y has changed, because YZ is distinct from XY, so it’s not cached. In practice, however, this wasn’t a problem: users wanted to avoid this cache-busting behaviour anyway, since it means you’re redundantly fetching the same record multiple times. In principle it could also be mitigated by rewriting queries and results, if you know more structure about the data store.
@Milan_Openfeint Жыл бұрын
I'm a bit late to the party, but at 28:05 the function iCanCodeRT is pretty clearly not "referentially transparent" as defined by Gjeta, since it can return different results with the same parameters - it depends on the state of anotherRTNode. If this is allowed, how is it different from standard stateful procedural programming?
@jeberle1 Жыл бұрын
She states that referential transparency means that a series of calls can be reordered w/o changing expected results. The calls are indepenedent of one another. Pure functions have the property you describe. Same args in means same results out.
@exl5eq282 жыл бұрын
22:00 "no developer write code like this" it's daily life for c++ devs lol. `std::shared_ptr`
@garorobe2 жыл бұрын
No. We use aliases and type tagging/wrapping/subclasses.
@monad_tcp2 жыл бұрын
17:27 Its Erlang, isn't ?
@monad_tcp2 жыл бұрын
21:45 transpose and/or traverse to reorder the layers of stacked monads . I did that on F#
@ThinklikeTesla2 жыл бұрын
Great talk! I can't figure why the annotation is called @node. I know everything's getting taken over by NodeJS, but I don't think that's it. :) @referentially-transparent is too long. @pure?
@lawrencedanna2 жыл бұрын
I'm guessing it refers to there being a directional acyclic graph in which the nodes are invocations of @node functions and the edges are data dependencies between them.
@a_external_ways.fully_arrays2 жыл бұрын
In general an interesting talk - thanks. I had some comments underway: * The monad is not _in_ your type system - the type system is able to _express_ the monad * The fact that Scala doesn't have a way to express concurrent threads in their for-comprehensions doesn't say anything about FP languages in general. In fact the example you made isn't relevant for OCaml where we have a monadic 'and' operator. E.g. "let* v = some_thread1 and* v' = some_thread2 in ..." * I worked with Scala for 4 years - it's one of the most messy languages compared to other statically typed FP languages, in terms of libraries, culture, language syntax, language semantics etc. * In OCaml I have positive experiences with the concurrency monad - though I agree that rearranging/mapping stacks of monadic values is cumbersome - but it doesn't happen that often. * SQL handles concurrency, yes, but debugging bad performance in SQL is horrible. You can't just write anything you like - i.e. if you want performant - you need to know what the query planner will do. In the end this means that real-world SQL is not fully declarative.
@sidneymonteiro3670 Жыл бұрын
Where is the link to github with the implementation?
@yasinyaqoobi2 жыл бұрын
Wonderful talk.
@jhorneman2 жыл бұрын
Really nice talk!
@adambickford87202 жыл бұрын
So async/await as a product for scala?
@KeremyJato2 жыл бұрын
Well presented talk!
@slowpnir Жыл бұрын
5:52 Wild guess: `Applicative` functor
@holykoolala2 жыл бұрын
Could Scala implement this as an official part of the language?
@twin94082 жыл бұрын
cool, good talk
@jackgenewtf2 жыл бұрын
I wanted to clarify something. You had mentioned the "colored function" problem. But isn't that what you are introducing here? Just that instead of the "async" keyword, you introduced the "@node" annotation?
@pas.2 жыл бұрын
not really. the problem with colored functions is that they then in turn color other functions. here all that is hidden. @node function can return primitive types. you can write functions without thinking about what kind of functions might call it. (or without thinking about what kind of functions you can call.)
@fabracht2 жыл бұрын
Very interesting topic. Bravo!
@XArticSpartanX2 жыл бұрын
not really a fan of how she frames the issue at the beginning. Futures offer failure states, Future.failed. You can map over these and even catch them. They also nest throwables, so you can specify what type of exception is (was) thrown. In addition, Future.sequece and Future.traverse solve her last problem of not handling a future of sequence, or a sequence of futures. I do agree this mental gymnastics is not beginner friendly, but the power it gives the developer is well worth the energy required to get up to speed with these concepts. I am kinda surprised she brough up such beginner issues.
@yawaramin47712 жыл бұрын
Because the vast majority of developers will be at that level. It's really only a tiny minority of devs who actually ever dive deep into the category theory rabbit hole.
@jackgenewtf2 жыл бұрын
Understanding how to use futures correctly, and "diving deep into the category theory rabbit hole" are not the same thing. I understand everything @XArticSpartanX said about the Scala Futures API, I had those concerns too, watching the talk, but I couldn't tell you the first thing about category theory.
@duncanw99012 жыл бұрын
@@yawaramin4771 The category theory rabbit hole is ankle-deep. It's simpler than almost anything else in mathematics.
@sigmundwong2489 Жыл бұрын
@@duncanw9901 That's just plain false. The very fundamentals of CT are ankle-deep, but the reason that CT is useful is because it gives you an ankle deep wading pool from which you are able to extract killer-whale-sized mathematics (and in a highly principled way). Consider the fact that, for example, all of formal logic can be phrased in terms of CT, as can much of quantum mechanics. There is a lovely paper wherein a handful of axioms are used to form a category; the authors then prove that such a category _must_ be a category of Hilbert spaces and bounded linear operators (the basic language of QM/QIC). To claim that the basic definition of a category is easy is one thing; to claim that the whole of category theory is trivially understood is disingenuous, and frankly oozes of hubris.
@dobotube2 жыл бұрын
The type intrusive garbage collected language is... Rust!
@SimonBuchanNz2 жыл бұрын
Rust is exactly as garbage collected as C++, that is, it is not (without libraries at least)
@jonaskoelker Жыл бұрын
I believe OP's point was that information about memory handling (mutability and lifetimes) seeps into your type declarations, similarly to what was shown on the slides. Or maybe I was missing the point. Maybe it was really "intruding information about GC generations into your types is just as bad as introducing execution concerns into your code" and not "intruding information about memory handling (in some form or another) into your types is just as bad as introducing execution concerns into your code". I think something else, though.
@klasus23442 жыл бұрын
This is like an effect system, but not builtin to the language
@xremming2 жыл бұрын
All I am hearing is "problems that Go does not have" when I am listening to this talk. Sometimes complexity just is not a solution.
@TaranovskiAlex2 жыл бұрын
so you "invented" coroutines in scala. interesting. will this all be basically obsolete once the loom project is delivered?
@NoNameAtAll22 жыл бұрын
what's loom?
@piraka_mistika2 жыл бұрын
if you watch the questions section at the end, Gjeta mentions Loom a couple times
@PeerReynders2 жыл бұрын
@@NoNameAtAll2 “Project Loom, Fibers an Continuations, is to intended to explore, incubate and deliver Java VM features and APIs built on top of them for the purpose of supporting easy-to-use, high-throughput lightweight concurrency and new programming models on the Java platform.”
2 жыл бұрын
loom doesn't do batching or caching, so no. Don't think she explained how the batching works, maybe there are other annotations.
@virkony2 жыл бұрын
I think talk was started about having solutions, but they are clunky. If I understand correctly, Loom supposed to breake away from OS threads and from mandatory stack traces allowing tail-call elimination. You still need to incorporate that in languages and run-time that do those multiplexing IO implementation (that "interpretation" mention). Just spawinging bunch of fibers is not going to bring you batching and caching. I suspect only thing that Loom might make obsolete is how those async nodes of execution represented and wired. P.S. coroutines - is a bit messy term in my opinion. Sometimes it refers to tearing/re-wiring apart linear code (e.g. Python generators), and sometimes it referred to continuations (e.g. async in Python/C#).