Javascript to Elm

57: Staying the Course

Informações:

Synopsis

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