The full video and many others like it are all available as part of our Frontend Masters subscription.

Brian Lonsdorf

Brian Lonsdorf has taught several workshops and training courses on functional programming with javascript. He'a a regular speaker at conferences and helps organize/host FP events around the Bay Area.

Brian Lonsdorf

Hardcore Functional JS

After having a few debugging issues, Joe walks through a few commits of the project to help summarize the final code in the YouTube demo application. Brian adds a couple last remarks as they conclude the course.

Get Unlimited Access Now

Joe Nelson: We had two streams we ended up making, our search input and our click stream. Clicks stream, how would we read this? What happens?
Brian Lonsdorf: Well, we just left it messy with the inner compose.
Joe Nelson: There's a cool part of it actually because what we did is we put it on document.

We found toDocument so that was the maybe thing. You remember that, Brian?
Brian Lonsdorf: Yeah. It's in that YouTube ID where you try to get the YouTube ID at any document click. So we just take any document click and put it in a maybe. And then if it doesn't have a YouTube ID on it, if it's not an element with a YouTube ID we just don't run the player.

Joe Nelson: So when I'm clicking around on the page but not on an LI It gets to click. It goes through the stream. It eventually hits this YouTube ID thing. Actually, yeah it tries. But this could return like not a maybe, like a bad maybe. Maybe you don't map over because the thing you clicked on, didn't have a dated YouTube ID.

Had you clicked on the list, though, it'll get picked up and it'll get what it needs. So, the click could be anything. I don't know how sound it is, but it's fun. It's interesting to see that you click anything and it knows what to do because it's in the right functors.

Brian Lonsdorf: The bottom line there, I think we'd probably factor a little bit before pushing main thing because that's just kind of like why are we map composing this stuff. Like Player creates pure, why doesn't that go up there I would probably put the player create inside of some kind of just returning HTML.

So we're saying on value get the YouTube ID why not just get the player right there and then we'll set the HTML to the player?
Joe Nelson: I think the reason it didn't come up in regular Chrome is because of an iFrame restriction of some kind like a YouTube.

Brian Lonsdorf: Yeah, but I was just pointing out, these are just like what puts together before I wish we'd refactor a bit. Anyway, yeah, I think we should push this through refactor for a second, then push it as an example of something you can do where your whole app is pure, easily tested, memorizable, portable, whatever.

Joe Nelson: Yeah, so we'll put all my stuff or so, here see you too and all the libraries you saw the slides all over any changes that happened to jazz fans and all the stuff will be available for you to try again and if/when you have questions and all these craziness.

Just tweet at us or whatever. We're happy to help.
Brian Lonsdorf: Yeah, I also said, I didn't have time to get to applicatives and monoids. Those are so much easier than functors and monads. So if you look at the slides and you guys have questions, just email me. Or we can try to have some kind of thread follow up.

We can talk, maybe we could get an email list of just like, here's the rest of the slides. Ask me questions on the list, or something? I don't know if there's a way to get that. But, yeah, we'll just figure it out. Or we'll set it up and you can sign up.

Speaker 3: Yeah, we have a forum. We just don't use it, so I can set up a new thread, or whatever, and send everyone to it.
Brian Lonsdorf: Cool, yeah. So in case you were dying to hear what applicatives were you could talk to me about it.
Brian Lonsdorf: And the other part of it is there's a lens library, that, it's mind-blowing if you know how functors work, otherwise it's just neat, so.

If you guys go check out lenses and kind of understand it's built on F map. It's like woah, but that's all I wanted to say.
Joe Nelson: That's all I want to say as well.
Brian Lonsdorf: Yay.
Joe Nelson: Cats

Ready to take your code to the next level?

Intense courses with world-class teachers and unlimited access to our growing library of videos for the great price of $39 per month.

Get Unlimited Access Now