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.
@pa8w10 жыл бұрын
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__7 жыл бұрын
Eternal Sunshine of the Stateless Mind
@ccidral5 жыл бұрын
Wow, didn't know Sean Connery was that smart!
@qcpwned072 жыл бұрын
The link to the slides, code and exercises is dead. Anyone knows where one could get it?
@LeonidBraynerMyshkin8 жыл бұрын
I wasted a lot of time wading through Haskell's source code for the state monad. Could have just watched this excellent video.
@meowmeow708 жыл бұрын
really enjoying this series. please do part 3.
@smwnl907210 жыл бұрын
~ 42:35 programmers who don't do math smell bad
@bartfrenk10 жыл бұрын
Anybody know which paper he is referring to at 16:32?
@user269128 жыл бұрын
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.
@SomeMrMindism4 жыл бұрын
It's "Representing monads" by Filinski
@BosonCollider8 жыл бұрын
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.
@firefly6188 жыл бұрын
+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
@okuno548 жыл бұрын
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
@bmjames10 жыл бұрын
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,
@JackSchpeck10 жыл бұрын
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?
@firefly6188 жыл бұрын
+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.
@jeffreycliff9222 жыл бұрын
@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.
@TankorSmash7 ай бұрын
The file link is down :(
@LizardanNet7 жыл бұрын
When he says "monad maker" is he referring to bind (>>=)?
@TimTeatro7 жыл бұрын
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 Жыл бұрын
"apply your negative attributes to too_negative_to_retire function".. functional is a way of life..
@MCLooyverse3 жыл бұрын
Oof, I guess I'm a few years late to grab the .zip file with all this stuff. It's a dead link now.
@flereoussarg3 жыл бұрын
Same here! I'd love to have this stuff too.
@sonicbhoc2 жыл бұрын
@@flereoussarg Is there a way to get it back? Is it on the Wayback Machine or some other archive?
@YumanoidPontifex9 жыл бұрын
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?
@MiroslavPrymek9 жыл бұрын
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.
@magniffsdigitaldevices21538 жыл бұрын
Wow! just wow)
@meanmole32129 жыл бұрын
Is there some standard (like UML) for those drawings with arrows that describe the functions seen in the video? Looks pretty useful.
@charvakpatel9628 жыл бұрын
its MS Visio
@toonvanhauwermeiren40132 жыл бұрын
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?