Brian Beckman: The Zen of Stateless State - The State Monad

  Рет қаралды 48,242

jasonofthel33t

jasonofthel33t

Күн бұрын

Пікірлер: 36
@firefly618
@firefly618 8 жыл бұрын
This was just brilliant, especially the diagrams. None of the tutorials I've read ever thought of calling the right operand of bind a "monad creator," but that's exactly what it is! It makes perfect sense. Thanks for all the insights. Who knows if we'll ever see part 3 on the continuation monad! One can hope.
@pa8w
@pa8w 10 жыл бұрын
Very well done! Thanks! The best introduction to the state monad I have seen so far. The way he gets to it makes you understand why the strange looking signature s -> (a, s) makes total sense. Also I love the term he uses for the state-monad return function: monadmaker. Once you get there the state monad bind operator comes natural.
@disk0__
@disk0__ 7 жыл бұрын
Eternal Sunshine of the Stateless Mind
@ccidral
@ccidral 5 жыл бұрын
Wow, didn't know Sean Connery was that smart!
@qcpwned07
@qcpwned07 2 жыл бұрын
The link to the slides, code and exercises is dead. Anyone knows where one could get it?
@LeonidBraynerMyshkin
@LeonidBraynerMyshkin 8 жыл бұрын
I wasted a lot of time wading through Haskell's source code for the state monad. Could have just watched this excellent video.
@meowmeow70
@meowmeow70 8 жыл бұрын
really enjoying this series. please do part 3.
@smwnl9072
@smwnl9072 10 жыл бұрын
~ 42:35 programmers who don't do math smell bad
@bartfrenk
@bartfrenk 10 жыл бұрын
Anybody know which paper he is referring to at 16:32?
@user26912
@user26912 8 жыл бұрын
It might be Berdine (2002). Linear Continuation-Passing. Higher-Order and Symbolic Computation, 15, 181-208. Abstract: Continuations can be used to explain a wide variety of control behaviours, including calling/returning(procedures), raising/handling (exceptions), labelled jumping (gotostatements), process switching (coroutines),and backtracking. However, continuations are often manipulated in a highly stylised way, and we show that all ofthese, bar backtracking, in fact use their continuationslinearly; this is formalised by taking a target language forCPStransforms that has both intuitionistic and linear function types.
@SomeMrMindism
@SomeMrMindism 4 жыл бұрын
It's "Representing monads" by Filinski
@BosonCollider
@BosonCollider 8 жыл бұрын
I sort of wish Haskell allowed print to stdErr as the only function with side effects in the language. That would make logging/debugging easier.
@firefly618
@firefly618 8 жыл бұрын
+BosonCollider It does. It's called trace. wiki.haskell.org/Debugging You use it like this: trace (string to print) (value to return) usually replacing the last parentheses with $: trace (string to print) $ value to return which makes it easier to comment it out: {- trace (string to print) $ -} value to return Here's an example tracing function call order: > import Debug.Trace > let f 1 = 1; f n = trace ("f " ++ show n) $ n * f (n - 1) in f 4 f 4 f 3 f 2 24 Here's another example tracing both function calls and return values: > import Text.Printf > let f 1 = 1; f n = trace (printf "f %d" n) $ let r = n * f (n - 1) in trace (printf "f %d => %d" n r) $ r in f 4 f 4 f 3 f 2 f 2 => 2 f 3 => 6 f 4 => 24 24
@okuno54
@okuno54 8 жыл бұрын
Check out the Debug.Trace module. It's in the standard library: hackage.haskell.org/package/base-4.9.0.0/docs/Debug-Trace.html
@bmjames
@bmjames 10 жыл бұрын
Could you upload a higher-resolution version of this video please? It is quite hard to read what's on Brian's screen in 480p,
@JackSchpeck
@JackSchpeck 10 жыл бұрын
Thank you for this great video! It's full of insights. I have a question that might be a bit off topic, but what's the name of the program Brian used to create / present the schematic drawings of the functions?
@firefly618
@firefly618 8 жыл бұрын
+Jan Hrček That would be Microsoft Visio. You can find the Visio file in the ZIP that's linked in the description, along with the source code.
@jeffreycliff922
@jeffreycliff922 2 жыл бұрын
@51:19 Wow he's at the point where when asked which of 3 lambda-carrying languages to use the question of available libraries isn't even in the top 3 reasons.
@TankorSmash
@TankorSmash 7 ай бұрын
The file link is down :(
@LizardanNet
@LizardanNet 7 жыл бұрын
When he says "monad maker" is he referring to bind (>>=)?
@TimTeatro
@TimTeatro 7 жыл бұрын
I'm not sure exactly where you mean, but if it's near the beginning of the explanation of the State monad, the function with signature `a → (S → (S, a))`, that's `mreturn` or `return`. In the case of the state-monad, `return` takes a value and wraps it in the monad, which is a function that will pass state unchanged from argument to return, alongside the original value. For example `mreturn(5)` (where 5 is an int) will produce a callable with signature `S → (S, a)`, and when you call it with `s : S`, you will get back as a pair (s, 5).
@tuberklz
@tuberklz Жыл бұрын
"apply your negative attributes to too_negative_to_retire function".. functional is a way of life..
@MCLooyverse
@MCLooyverse 3 жыл бұрын
Oof, I guess I'm a few years late to grab the .zip file with all this stuff. It's a dead link now.
@flereoussarg
@flereoussarg 3 жыл бұрын
Same here! I'd love to have this stuff too.
@sonicbhoc
@sonicbhoc 2 жыл бұрын
@@flereoussarg Is there a way to get it back? Is it on the Wayback Machine or some other archive?
@YumanoidPontifex
@YumanoidPontifex 9 жыл бұрын
i'm a beginner haskellite, and i have a question: i know how to use recursive function that passes some accumulating value to itself (returns it as a tuple element, calls itself with that element as an argument). does this mean i'm using a monad without knowing it, or is that something different?
@MiroslavPrymek
@MiroslavPrymek 9 жыл бұрын
YumanoidPontifex It's different. It can be a little bit similar in principle (it's another mean how to deal with a state) but it's not a monad-as-it's-talked-about.
@magniffsdigitaldevices2153
@magniffsdigitaldevices2153 8 жыл бұрын
Wow! just wow)
@meanmole3212
@meanmole3212 9 жыл бұрын
Is there some standard (like UML) for those drawings with arrows that describe the functions seen in the video? Looks pretty useful.
@charvakpatel962
@charvakpatel962 8 жыл бұрын
its MS Visio
@toonvanhauwermeiren4013
@toonvanhauwermeiren4013 2 жыл бұрын
I have the same question. MS Vision is just a tool. It's more about how you represent the concepts. E.g. product types appear to be represented as parallel arrows, how do you represent sum types?
@DoktoreBlah
@DoktoreBlah 5 жыл бұрын
"Okay."
@chickenstrangler3826
@chickenstrangler3826 7 жыл бұрын
He looks like a bald Santa.
@leftover7766
@leftover7766 6 жыл бұрын
crap quality
Brian Beckman: Don't fear the Monad
1:07:10
jasonofthel33t
Рет қаралды 402 М.
What is a Monad? - Computerphile
21:50
Computerphile
Рет қаралды 610 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 21 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 39 МЛН
路飞做的坏事被拆穿了 #路飞#海贼王
00:41
路飞与唐舞桐
Рет қаралды 26 МЛН
Expert to Expert: Rich Hickey and Brian Beckman - Inside Clojure
53:56
jasonofthel33t
Рет қаралды 113 М.
Regaining Control with State Monad and Friends (Felix Mulder)
25:32
flatMap (Oslo)
Рет қаралды 6 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Brian Beckman: Monads, Monoids, and Mort
1:03:55
Mid-2000s Throwback
Рет қаралды 838
Category Theory for the Working Hacker by Philip Wadler
50:52
Lambda World
Рет қаралды 93 М.
Robert C  Martin -  Functional Programming; What? Why? When?
58:27
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 673 М.
Outliers: Why Some People Succeed and Some Don't
1:16:05
Microsoft Research
Рет қаралды 3,1 МЛН