Javascript to Elm artwork

57: Staying the Course

Javascript to Elm

English - November 08, 2018 11:00 - 19 minutes - 16.5 MB - ★★★★★ - 4 ratings
Technology elm javascript programming Homepage Download Apple Podcasts Google Podcasts Overcast Castro Pocket Casts RSS feed

Previous Episode: 56: Meow Done

We go from planned topic to full scale book review. But we've strung together a small string of victories, and that feels pretty good.

Sticking with Haskell Not really wanting to do JS at work, daily. I want to understand the underlying workings of it. I want more stable, elegant code. I keep trying to make custom types in JS, and it’s totally not working. Hence my interest in TypeScript lately. By defining the shape of the data that is allow, it removes an entire class of bullshit that I have to be reactive to in JS. And I really don’t like it. How can I do this better ? Lambda Functions and Scope Prelude> oVer x = (\x -> (\x -> (\x -> x) 4 ) 3 ) 2 Prelude> oVer 4 Prelude> overWrite x = (\x -> (\x -> (\x -> x) ) )(2)(3)(4) Prelude> overWrite 1 So why does this work? At first I wasn’t sure. I have this nagging sense that nested functions are difficult to reason about, this is about the time I struggled with the pipe operator (|>)

These let and where examples of using a lambda function may initially seem academic and contrived, but they’re the basis of one of the most important design patterns in JavaScript

It’s mind bending to me to have lambda expressions explained in a Haskell book, using JS. I need to remember all the little nuances of JS that I have absorbed over the years, and that other languages are the same.

JS using lambda functions to encapsulate scope.

Holy sh-nikes haskell uses lexical scope too. It even has a diagram.

Resources Get Programming with Haskell by Will Kurt Philosophy of Software Design by John Ousterhout Follow

JavaScript to Elm

Twitter: @jstoelm
Email: [email protected]

Jesse Tomchak

Twitter: @jtomchak

 

Twitter Mentions