Javascript to Elm

Informações:

Sinopsis

A podcast about using Elm coming from Javascript and other languages

Episodios

  • 70: Haskell Serverless

    21/02/2019 Duración: 23min

    Finally Ready to Go We’ve got our environment all set up so let’s get going! Steps A new stack project using the template stack new my-haskell-lambda https://github.com/theam/aws-lambda-haskell-runtime/raw/master/stack-template.hsfiles --resolver=lts-12.13 --omit-packages Say it with me “stack is not like NPM, it is NOT a package manager” stack handles the management of your tool-chain. resolver ? Specifies which snapshot is to be used for this project. A snapshot defines a GHC version, a number of packages available for installation, and various settings like build flags. It is called a resolver since a snapshot states how dependencies are resolved. There are currently four resolver types: omit-packages ? this leaves the extra-depsflag commented out in the stack.yml Added to stack.yml packages: - . extra-deps: - aws-lambda-haskell-runtime-1.0.9 initially I had only added the extra-deps. I didn’t realize that having added --omit-packages I still needed to add packages . running make and we’

  • 69: Stack Docker Adventure

    15/02/2019 Duración: 33min

    Serverless Call it whatever you want. I just like the lack of sysAdmin work there is to do. That being said. I just recently spent a silly amount of time self hosting a wordpress instance bc I wanted fine grain control. With serverless, I still have control over the pieces I care about, and don’t have to worry about the rest. Meow Notes API is all serverless. And Even from a ‘cold’ start it’s pretty snappy. Setup Stack with using the build in docker support MB:lambda-haskell> stack install aws-lambda-haskell-runtime Wait progress 2 of 110 ?!? This is when I need to remember that I spend my days waiting for npm to resolve 800 something packages to start a NEW project in JS. Also mad props to the npm team for their thankless hustle and work these past years. I’ve benefited. Convinced this was not a good idea. So I added it to the extra deps like the docs say to

  • 68: Blogs Are Back

    07/02/2019 Duración: 21min

    Year of Content 30 Days In Should have been called the year things I don’t feel I am good at. Like CSS Devops CI/CD Pipeline Things I’ve learned in making my blog actually readable SEO is a lot more complicated than I give it credit for. meta tags for days. All I wanted was that nice card when I posted a url to my blog. React Helmet adds a bunch of those metadata elements to your page for you. Get it? like a helmet. Here’s the worst part. I’ve been using Helmet. A lot. Like for years. I use it at work. And guess what, I had no idea really why. It was just a thing you do for site mapping, or HTML data or something.

  • 67: Call For Papers - Check in

    25/01/2019 Duración: 19min

    Making progress for conference rejections I didn’t want this to be a, look over here I’m struggling with Haskell episode, or that I chose to take a break, because I haven’t. Rather it chose me. I mentioned that as I do more of the exercises, I mean actually do the exercises that my velocity has slowly. well it’s really slow. Elm in the Spring CPS’s Elm + Markdown = ♥ Resources Call for Papers List Get Programming With Haskell Pillars of Functional Programming Haskell at Work with Oskar Wickstorm State of WebGHC Ryan Burgess Conf List Follow JavaScript to Elm Twitter: @jstoelm Email: jesse@jstoelm.com Jesse Tomchak Twitter: @jtomchak  

  • 66: Getting Haskell Lesson 21

    17/01/2019 Duración: 19min

    Haskell IO Doing the exercises Haskell read, let’s us take a String IO and read out a Double 2 value assignments in the where clause, but got an error til the spacing lined up? unit-4/pizzaCost.hs:15:32: error: parse error on input ‘=’ Perhaps you need a ‘let’ in a ‘do’ block? e.g. ‘let x = 5’ instead of ‘x = 5’ Do Notation a member of the type class Monad Maybe is also a member of Monad I always try to spell pizza with an ‘e’ instead of an ‘a’. lol do-notation as a convenient way to perform IO actions in Haskell It’s important to contextualize this statement with where and when. We are 1/2 half into a getting started book for Haskell. Is this a complete definition of do-notation ? Most certainly not. Is it the most complete, and comprehensive? not likely, remember I’m just getting started, a novice. The point is, when it comes to teaching or conveying your ideas, there is a point of diminishing returns for how much information you give the student. Too little, and they’ll be confused and

  • 65: Haskell I/O

    11/01/2019 Duración: 21min

    It as dawned on me as I have tried to find a better way to number, categorize this episodes, that each unit has about a dozen lessons. So Unit 4, that we’ll cover now are lessons 20-23. IO in Haskell avoiding state is the one of the key tenants of Haskell. So how does Haskell rectify that tenant with the need to acutally makes changes to the outside world? like files, network requests, or other types of interaction You should know this by now. Types!! Special parameterized type name? you guessed it, IO Any value in IO context MUST stay in this context. This prevents it from clouding up or haskell environment of purity. For refresher, when I say purtity, what I mean is that it upholds referential transparency and doesn’t change state. Like a pure function. IO makes it impossible to use values that are from IO in pure functions where, that function is not expecting to get polluted values that can’t really be trusted. PSA Why writing every example is so important. Even as I write out the samples I had

  • 64: Themes

    03/01/2019 Duración: 14min

    What is a Theme and why it’s important First themes are not New’s Years Goals, more of an over arching Idea I’ve seen some good and interesting conversations around social media posting themes and sharing them Cortex Podcast I’d laid out somewhat of a plan for 2019, but rather than in my head, always better to get it out on paper and in my case podcast it to everyone. I’ve got 2, so and we’ll cover them one by one Creating Content The basic idea is I would like to produce, create, out pour more content that I consume this year. That means mindless twitter. Set a 30 minute limit on iOS for twitter a while ago Clean and prune my RSS feeds and Podcast feeds, which at this point are getting really, really out of control. I don’t think I ever actually finish them.. This might be a variety of outlets. This podcast for one newsletter daily / weekly blogging live streaming on twitch while I work AMA Tutorial Videos on things I don’t know, or things I want to know Conference talks Exception, I’ve made a

  • 63: Getting Haskell Unit 3 (part 2)

    20/12/2018 Duración: 27min

    Rounding off algebraic data types! Monoids So like we talked last week, about Semigroup, now we’re gonna add a little bit to that, requiring an identity element for the type changes a semigroup to a monoid! That’s it Well, it might seem like a little change, but it has a pretty sizable effect. Summarize identity x id = x as well as id x = x > function that always returns the same value that was used as its argument. In equations, the function is given by f(x) = x. I’ve mentioned it a few times previously. fold is possible because monoid has this identity function. Example. if you want to combine or mconcat a list of lists. Like say a list of Strings, which we know under the covers a String is a List of Char [Char] what if the list is empty ? Do we have to check for that possibility and handle that? That doesn’t seem very helpful. If you try to mconcat an Empty List, bc of the Identity function, f(x) = x, you’ll just get back an empty list! It totally knows what to do. And the best part is, we don’t have

  • 62: Getting Haskell Programming in Types

    13/12/2018 Duración: 26min

    Now on to programming with Types, Things are getting pretty good. Creating types with and | or Semigroups Parameterized Types The Maybe type Start with some definitions Algebraic data types: a composite type, meaning, any types that can be made by combining other types. and / product types: combining two or more types, very common. nearly all languages have support for these. Structs in C. This can often be the only way to make new types. This is the basis for class hierarchies. abstracting out what they have similar, and move downward. “real life is full of extreme edge cases” Side note about data and declaring, or forming the data. I really thought FP was function driven. But I’m not so sure I’d say that today. Yes yes functions as values are super important, but they more enable us to really focus on the structure and transformation of data, instead of actions or events on that data. or / sum types: > In computer science, a tagged union, also called a variant, variant record, choice type, di

  • 61: Getting Haskell Unit 2 (TypeClasses)

    06/12/2018 Duración: 23min

    Follow up Elm does not currently support type classes. Does it need to? Using TypeClasses Implement your own type classes Understand polymorphism in Haskell `Know when to use deriving Search for documentation with Hackage and Hoogle Show class Show a where show :: a -> String turns any value into a string for output So the output we see from GHCI automatically derived typeclass Vanillia | Chocolate Ord class Eq a => Ord a where compare :: a -> a -> Ordering ( a -> Bool ( a -> Bool (>) :: a -> a -> Bool (>=) :: a -> a -> Bool max :: a -> a -> a min :: a -> a -> a Cool, Ord is defined as a Eq class. oh that’s rad well i guess if you’re gonna order something you’ll need to compare it’s equally, just like it says in the the compare definition. compare :: Ord a => a -> a -> Ordering man it makes so much sense it’s a bit frightening. EQ class Eq a where (==) :: a -> a -> Bool (/=) :: a -> a -> Bool pretty straight forward takes, 2 values and returns a bool, True or False

  • 60: Getting Haskell Unit 2 Types

    29/11/2018 Duración: 27min

    Into to Types Basic types this is where we get the : : and then the variable definition, we tried assignment, something to differentiate it from the typical variable assignment we do in JS starts with a capital letter Tuple types type inference i think this is under appreciated, but so far in 2 weeks we have been writing Haskell without type signatures. relaying on the compilers ability to infer those types function types the -> is used to separate arguments and return value Polymorphic Haskell does not DO implicit type conversion, or what we affectionately call coercion in JS “their type is determined from the compiler based on the way they’re used” Simple example is 5/2 you don’t need to put 5.0 / 2.0 to get a double back of 2.5 show and read functions with multiple arguments partial application, remember lazy evaluation, more on that later I see nested function calls and I just want to shout ‘pipe operator!!!!’ i think it’s called bind in Haskell types for first class functions reme

  • 59: Getting Haskell Unit 1 (part 2)

    22/11/2018 Duración: 26min

    Corrections and feedback WOW, didn’t even mention immutability last week. When? at any point? Ever! Several of the examples we went over would have benefited from a mention that variables in Haskell are IMMUTABLE I put it in bold to make up for the lack of it last week. Maybe? Right? Also missed spoke about partial application. I said once the function gets all of it’s arguments, then and only then will it evaluate and return. But in Haskell that is not the case. If fact, it’s the exact opposite! Haskell is lazily evaluated so until that return value is needed, Haskell won’t do anything with it. Say like an infinity list, that is totally ok in Haskell, it’s not going to cause a stack overflow, or throw an exception. —we’ll get more into that later. Lists This is a big one. So much of the data structure and transforming is using lists! So we’ve got to get a really good understanding of this if we want to move forward and not fall on our faces. And by faces, I mean get over that hump and really understand Ha

  • 58: Getting Haskell Unit 1

    15/11/2018 Duración: 21min

    Unit 1 Functions Haskell does not allow side effects Must return a value Interesting that you can’t do x++ because every time you do it on the same assigned variable, the output is different! variables as definitions REPL, GHCi, and let up intil 8.0 this is related to referential transparence First-class Functions and Lexical Scope lambda functions, anonymous functions. functions as variables functions as arguments, as return values A tuple is like a list, but can contain multiple types and is a fixed size! Sorting with compare. Haskell gives us GT, LT, and EQ. While JS gives us True or False Closures / Partial Application Closure is the the idea of ‘capturing’ values to dynamically create functions based on pervious arguments. Capturing a value inside of a lambda function, that often returns a function, is refereed to as a closure. Partial application takes this idea and applies to all functions. If you call a function, but do not give it all the parameters that function takes, Haskell will by defa

  • 57: Staying the Course

    08/11/2018 Duración: 19min

    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

  • 56: Meow Done

    01/11/2018 Duración: 26min

    Types of Learners What I meant by ‘Academic’ last week. As opposed to ‘Practical’. This, was a poor juxtaposition to put the things that have been hard for me to learn. Visual Visual learners prefer to take in information using charts, maps, graphs, diagrams, and more. Using images to explain concepts and ideas is the best way to reach a visual learner. However, this type of learning style does not include photographs or videos. Instead, visual learners learn best when information is presented using patterns, shapes, and other visual aids in the place of written or spoken words Auditory They benefit from lectures, group discussion, and other strategies that involve talking things through.“Often people with this preference want to sort things out by speaking first, rather than sorting out their ideas and then speaking,” Reading / Writing Pref “This preference emphasizes text-based input and output – reading and writing in all of its forms,” Kinesthetic Kinesthetic learners learn best when they can u

  • 55: Dependent Types Part 2

    25/10/2018 Duración: 21min

    Parametric Types Defining type signatures with parameters that are themselves valid types. Something like List Int would generally describe all lists in a given program that have items in that list that are integers Dependent Types If we take the idea of parametric types and stretch them a bit to behave more like functions, in the sense that they would take parameter values. Then you could have something like List 3 Int which would no longer represent any List that has Int values, but only List’s that have a length of 3 and are integers. Picks Resources Programming Language Foundations in Agda By Phil Wadler & Wen Kokke “Categories for the Working Hacker” by Philip Wadler A TALE OF TWO ASYNCS: OPEN SOURCE LANGUAGE DESIGN IN RUST AND NODE.JS, by Ashley Williams Co-recursive with Phil Wadler Follow JavaScript to Elm Twitter: @jstoelm Email: jesse@jstoelm.com Jesse Tomchak Twitter: @jtomchak  

  • 54: Dependent Types

    19/10/2018 Duración: 28min

    yeah, so dependent types? > In computer science and logic, a dependent type is a type whose definition depends on a value. A "pair of integers" is a type. A "pair of integers where the second is greater than the first" is a dependent type because of the dependence on the value. It is an overlapping feature of type theory and type systems. Terms: Set: An unordered collection of unique values Parametric types: Like parametric polymorphism. A function or data type that can be written generically so that it can handle values identically without worrying or knowing their types. An example of this would be append or concat two lists together. append: [a] -> [a] -> [a] Now a while ago, I would have read that and thought, WTF. or maybe the Identity property because it keeps using the a over and over again. BUT with the bit of knowledge on the subject I have I know that append does not care what type you have in the list. A list of Int, or Strings, doesn’t matter, as long as they are the same type i

  • 53: Elm Conf 2018

    04/10/2018 Duración: 40min

    Didn’t make it the Goal and that’s ok. We made a ton of progress. I mean a ton We have a better handle on Routing, parsing, decoding I feel like even though we didn’t make the goal, we hit the spirit of it pretty much on the head. And that feels awesome. It was a lot of time in Elm, and you know what. It was pretty rad. So How was the Conf? it was so much fun. We we talked about it being a pre conf. If you’ve listened to the show even a super tiny bit, you’ve had heard me say that. There was the ICFP that started the sunday before and went til saturday. A whole week for a conference!!! Holy cow. I’ve been to WWDC before, which was a week, but iOS never really had the social share aspect like the communities I’m in now. ICFP is a pretty hard core Functional conference, leaning more towards the academic side of things. There are research projects, and presentations of published papers. That sort of thing PWLCONF - Papers We Love trying to bring industry and academic together Software with a Mission - cr

  • 52: Gonna Make it

    25/09/2018 Duración: 20min

    Getting Through the routing Elm wasn’t updating when the URL changed. Probably bc we weren’t telling elm, only the react router. D’oh Elm Navigation helper function newUrl and modifyUrl newUrl takes a string and returns a Cmd only changes url currently on, does not all to the browser history, ? man, gotta learn a little more about browser API’s. So much of my time up til now has been reliant on the JS Framework to abstract those away. Not a bad thing, just never learned the core functionality that I was using. New Note and Existing note both launch to the right page!!! We are, in a funny way, right back where we started. Man we are in the deeps of Elm. This is fun. Getting note data by id Outing going data with note id as part of the request Done lots of these We’ll need to request it when the URL matches the “note” rough Ah, where to make this request? Probably best in the update where we are getting the UrlChange ? yeah. We can pattern match on if it’s the ‘Note’ route and then call that cmd the

  • 51: Elm Routing (Maybe)

    20/09/2018 Duración: 26min

    Getting over the hump for Routing We tired several attempts to define or explain routing in Elm, with varying degrees of success, mostly failing. Routing must be a pure function, since it’s not in the update function of our Elm App, it can not be a side effect Knowing that, the url coming in from the browser’s API is going to always be a string, then think, what kind of data do we want the route function to return to us? HTML? Here in lies my struggle. I know the input, but have not expressly figured out what the output needs to be. You can get this sense by my attempts to explain the route type signature several times in the previous episode. Use the Url parser and map We need a couple things Location is a record Extract Route a function that take the type Location and returns a Type of Route case (Url.parsePath matchRoute location) of parsePath takes matchRoute and that function takes a Location and returns us a glorious Route Match Route Need to Figure out this case statement matchRoute takes a functio

página 2 de 5