Rob Ashton - Purescript on the BEAM; Typed OTP for greatness | Code Mesh LDN 19

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
my name is indeed Rob I worked for that company there and have done for six or seven years now which is impressive anyone who has known me before that period I got a hopping around the place visit website and be amazed at buzzwords one of the co-founders can squeeze onto a single page but essentially what we built is bespoke media distribution systems doing encoding and delivery both on demand and in real time what as real-time is you can throw things like sports betting TV and nonsense like that I guess the key things really is it needs to be its high availability it's the best week better best of our abilities and the best of our clients abilities because it is TV after all and there's a lot of orchestration involved and Erlang has proven itself to be pretty useful for us to that end but that's starting to show its problems now the code base is over a decade old written by a couple of X Don that developers you've learned Erlang on the go and also you've joined and also learned Erlang on the go but now have over a quarter million of lines of Erlang just up there being used by Anu all of our clients very big set of core libraries to be able to do us to our jobs 30,000 lines of code per client sits on top of that to get by handing orchestration and auctioning between best cloud providers and doing the actual work of encoding itself we've got fairly rich front-end experiences and comparatively for our industry anyway if you've ever worked in the media industry you'd know that's not really saying very much it's good because we haven't got do a lot of work for our clients to get very excited about a very simple UI and we've had we've gone through a front-end bit of journey really when I when I joined the company everything was ember and ember in the worst possible way ever seen there's two-way data flows everything bound to something else and they've just flying every single direction you can possibly imagine and code apps everywhere and HTML and JavaScript arbitrarily separated all over the place and it was pretty atrocious and I very quickly switched that cost to react which at the time was fairly new because again over half a decade ago now and reactive is nice one way data flows markup and JavaScript tightly put together where it needs to be I don't care if that's controversial is it controversial still JSX I don't know it's a sensible thing isn't it good I'm glad I'm glad the standard JSX is wonderful but I still JavaScript so let's move on from that we went on to Elm Elm is nice it's been like play-doh you know you can build things with it but at a certain point you can't stop wanting to me mainly the problem of Elm is if you want to actually build real systems you can you kind of want to start building their own packages which means using the package manager which isn't very good it can't link to get a repos and less used sub modules and all starts getting a little bit unwieldy and also breaking out of the box the Elm in fixed upon you isn't really possible which is a good thing and a bad thing again Plato is probably right for us at the time play-doh is no longer right for us now so now we are on halogen and pure script on our front ends and the world is wonderful and we are now building our UI is in pure script and that's wonderful we have a similar story on our back ends with Erlang except it's just Erlang all the way down now obviously there's Erlang and there's Erlang you know here's a line with a record of know particularly sensation in it here's a function that takes one of these do's and does some calculation and here's Erlang properly annotated with types so you can run things over there and check stuff so you know coolness can be an integer or tuple it could be an integer our record and obviously and using to link inside the Erlang ego system we can obviously use these to navigate when we're making changes across our code base which has previous described is quite large so you've got a large code base and because of that we've changed the way right Erlang to best leverage both the compiler and the tools available to us now the problems become parents with the tools in Erlang with code bases of this size this is a picture of me running dialyzer on my laptop it's not good if my battery it's not good for my son and it's actually been a waste of my time keeps my hands warm though which is good so obviously you know we can get quite far by adding types on top of Erlang and using the compile and tools to guide us through our changes but it does start showing limitations eventually especially with code bases the size of powers so enter this chap here his case is called Nick and he he went to university and did actual learning and as part of that learning wrote a compiler for pure script to beam and that went on to read it a few years ago and everyone got very excited I think there's a post on white I can use of the orange place should be mentioned or whatever and that got everyone got me excited and kind of didn't really go anywhere which is sad for us because we saw this happen with wow that's relevant to our interests a compiler from pure skippity being that's such a clearly useful for us but nothing really happens with it so we did the logical thing which is we hired Nick two years after this fact because well if we're going to start writing pure scripts we should probably hire the guy that wrote the compiler to Earl and this bit not really sure but as profit involved somewhere in this process we now have the guy that wrote the compiler working for us and helping us with all up your script which is rich which is nice now wipe your scripts well as mentioned we're only writing our front ends in pure scripts affine history of doing things like there's your closure enclosure script you've got c-sharp and silver lights Java and JavaScript artichoke sorry no Jess in JavaScript yeah I guess the key things really are we get stuff for free because we're using a language that already exists rather than using something that's been invented for the beam punch exists already it's called PSE package and you've got all the nice types around that like spaghetti and dull and whatever it just in packages written in pure script that we can just go ahead and use right now okay then adding to package set that's okay things like editor tooling code exists so if you're using Emacs you've got a wonderful rich experience for editing pure script if you're using them you've got an experience for editing pure script it exists and of course tooling exists for doing type based searches and such through the packages that exist in pure script there's quite a powerful case here for just jumping in and using this stuff because all you have to do is write the compiler and everything else kind of follows and of course the cars been written by Nick's been done already so at a great high him get a list of the free and of course on top of that all our Erlang tooling still works no talk about that soon well obviously for the usual definition of works anybody who uses rebar three on a day-to-day basis with any code bases of real size will tell you that it's not without its rough edges so very quickly I'll do some sales pitch comparisons this would be where a one-on-one talk with n that say look how shiny this pure script isn't to walk off the stage and everyone think it's amazing but there are further demos to come that will obviously change it once it minds on that so everyone's familiar with that work ok on that screen yeah just about quickly go through some Erlang and pure script comparisons looking at the happy path only and just say this is what it looks like isn't it lovely so there's an application written in Erlang and here's a crippled application written in Pierce gift closing mouth or not I can't there we go beautiful isn't that pretty that's pretty pretty here's a supervisor written in Erlang and we have various modules being started to open this in various inputs there's modules like web Porto over here being taken was config types who needs them and just pull them out and put in places and hoping for the best very little we're verifying this quite messy okay let's go look at the script here we have a similar or identical supervision structure where we have typed arguments coming from config and being passed in supervision children with type checking on these startling functions over here and the compiler will pick up the pass the wrong things into the children but the original API still represent inside the pure scripts so the documentation for Erlang still carries across this quite tightly I assume it is largely familiar and legible to most people and it is a supervisor tree it's written in pure script so I mean what is there to say really over than that I'm not really sure and of course Jen service themselves this is a Jen server in like zooming out and zooming out until it's so small you can't see it can you want to see it at the back which like oh we still okay cool I can probably choose a different set of colors if that doesn't work out for you so have a start link and then it's over here there's an input which is the connection string and then we call startling and plastic like a string in here and there's a little we hear it gain no real type check and involved just passing things in and lists and such and hoping for the best if you want to call into this chancer ver I need to write a function which calls Jen server call buses in this tuple over here then match on this and then the function down here and again hope these two things link up again it's quite difficult to verify that the two things are separate I'm gonna call this Jen server passing in these things and hope that Jen server knows how to intercept those and do things with them okay I guess it works for some people here is Accords Jen server in Pier script so I've got some types of startups and it's like the state and my start link types those takes those type star tags and returns startling result and passes in as args to my list over here which in turn server context also typed type checking returns connection returns a type state that's type checked as well here's my if a great function which given a book returns the fact of either stringer book which does a call on that Jen server which takes a callback which is also types do things with the state and returns a type state again so all this is now verified and close together and there's no arbitrary functions this far apart with no type safety at all all very close and very legible and very shiny and very nice so from this demo here I'm sure everyone now loves pure roll and wants to go and start using it rather than Erlang and I can't blame you it's very pretty do you think it's really pretty I think it's really pretty yeah quite it has yes I actually like to not use the M word I just say it's the fact and don't worry about it much easier right so Purell is a no-brainer and talk here what time is it sorry five minutes left to go so I may as well carry on going I'm actually hoping I just go so slowly that this would be done by now let's just actually keep doing demos and just show you how it works underneath the hood and we'll get a better sense of what Purell actually gives us and what it doesn't give us and how things actually tied together I saw like probably 20 tell the audience does pure skip it already so to you this will all make most sense already because it's very much like the JavaScript world but the rest of it will be not like that so I have a canned folder of demo over here demo to Terry Gross is good and I've written nowhere lying in here I've deliberately kept that surface area of his demo very small the key components of a pure script application are this PSC package.json which have on should be familiar with from the airline world the difference being that our package set comes from the puerile organization rather than the PS organization there are a couple of extra modules available for as we want for example like Oh lists or whatever let's not worry about that just now I've got to make file over here which is going to invoke PSC package sources and then pipe that into person pile and compile any per script file it finds in my sources folder I'm going to leave this so you haven't got a gaze upon make any more than we have to my theme is hanging that's lovely thank you very much and I'm gonna open up Maine dot purse there we go it main dot purse I've got error because module peddling is not found I'm actually gonna be really brave [Music] one makeover conference Wi-Fi look at that there we go beautiful that's pulled down all the core packages and dumped them in dot PSD package I'm actually not going over conference Wi-Fi I'm tethered to my mobile phone so not only am i running Arch Linux and connected to a projector over some rear x-rounder hacker I'm also tethered to my phone and legs as well yeah of those desktop this probably is not but it is working so when output directory over there from compiling my single beam somebody slipped my single dot purse what's in that cup put directory gosh quite a lot of things so Nick has sat down and braved the world of writing all these standard modules in pure script slash Erlang and when you pull down preludes and sort these things now exist and they get compiled into let's go look where they can pop into showy let's go look at our demo app demo module which is called main the main PS doggerel so some things have no tier modules compiled by pers get compiled into URLs nothing else so that means there's a two-stage compilation process involved if you want to use pure script the first one is take pure script turn it into Erlang the next one is used the rest of your tooling pipeline the ordinarily would to take those files and make beans out of them that's a practical thing that I guess he's done because it's easier than the alternatives I would imagine a better technical solution would be go directly to bean but that's not how it currently works and that's fine because it fits our needs so modules end up with an app yes on the end of them I believe it was an underscore at one point but then you get clashes no one seems to use at in their module names but it's it's a valid atom so that's what we have here it means every to have to link that doesn't expect an that breaks and falls over at the two legs problem the tooling is wrong obviously obviously there is no exports are not really code yet so it's just an empty module nothing in it and a pile of compile shadows because the Erlang generator is not necessarily the Erlang one would write fair enough let's write a function let's just do that let's just jump in and say gosh there's a heavy complex function isn't as enterprise code mm-hmm now if I just quickly develop an editor over here I would expect right there we go so Tim's launched occurs IDE in the background and my IDE support actually now works for compiling the spy on doing type checking and such so if I get rid of Prelude it's going to complain because there's no idea what pluses and I get that in my editor for free again using pure scripts because because I get it tooling for free no one company extra work to make that work it just does which is nice so let's go and compile that and open that file again and just see what we've actually got there you go there's our function button Erlang cuts so you know it's not terribly complicated obviously if you're opening of our real gen servers it locked Harry as a general rule you don't open these files anyway so it's okay you'll notice that there's pile directives in here to actually make sure the compilation errors turn up in the right place and your pure script code anyway so when you utter you've run time errors sorry so when things crash you get a call stack and the call stack normally tells you roughly in the pure script where actually happened so generally you haven't got about digging for the Jerry to do Erlanger actually found a bug and rebar 3 relating to that which I gotta patch I have contributed to be by 3 I've done my duty which is which is nice a part of that so anyway I'm going to generate some beans out there and actually run apparently I don't have to do that anymore so I'm gonna run make beams and that just runs the LC compiler over the any all the URLs in that folder and gives me hopefully a list of beans in that folder yeah so these your ordinary beans they ordinarily have an airline world and if I do an Erlang PA of our beams directory I can load that module and I can call that module once I call a function game card and I didn't see it's just an ordinary function in their language at that point so that's nice because it means I can write functions in pure script but I can call from Erlang that's not necessarily something you do manually but if she laughs api's do like to take MFA's and such and if you're working case legacy Erlang you can pass in your pure Cup functions and they'll just work as you'd expect them to work in the Erlang world which is quite handy so you could actually buy gen servers like that if you want so you can sit down you can write your start link and your handle infos and such and cost your fingers and hope for the best that the callbacks match up and it's pretty ugly but you can do it because the just function is have young the day which is nice was it wasn't it Polly good I guess I'll do a quick thing here as well let's say I want to base64 encode some strings or something that's just as a default library in a line called base64 Anakin encode strings and I want to call that from pyramids let's quickly cover that now because it's the easiest thing to do I didn't yeah I'll do that now why not so next to files like these the purse files I can quite happily go main dot girl so I've got a pair of files here and this is my foreign function import file and I'm going to give that a module name of main foreign just notice and lovely name what's involved and I'm going to export a function called base64 text sixth single directly try let's use to mate editor shortcuts because I might confuse anybody right a 64 encode might import it thank you very much so I've got a function ever written in Erlang and I can actually export that see this world over here by typing foreign import base64 and honestly it's takes a string and returns a string now this is this is relying on me to be honest here I'm being you know am I could lie or this thing takes and no one's gonna check but obviously once you're in pure script world they've got this right any bear parsnip relying on this will also be correct which is good you're not going to go runtime error so the question is for the benefit of the recording is if I happen to make this string to end compilers LOC and complain because it does know any better basically for whatever and it's not going to play a runtime either until I try using that in some way and then you go runtime error absolutely yes generally which can serialize that cost the wire things will get pretty unhappy generally just don't do things like that because it's daft but I will show you later actually quite handy to lie by the types or at least use opaque type Suns leaf recover and now I'll show a less useful afterwards but anyway that does Chris me a function that cause a function it's not terribly exciting but if I do a and main over here it is up like an effect unit and I don't know let's just do a probably console imagine there's probably debug you know so it's just let's just try I would like to have in per unit for some reason I don't know why that areas it just really makes me feel happy oh look unknown type of fact well I'll import that unknown module console I'll import that no idea I kind of imported two haven't actually added to my no no is there's probably not called consoles or it's called something else for debug that I it's okay because I wrote notes on an iPad over here generally professional so it's log obviously don't use console in real applications a lager or something that they go so I can import I have one of those two things over there and now all the compiled hours are fixed so that's quite nice my tooling is actually working very nicely in pure old world and I'm done extra to make that work which is nice so I'm going to go ahead and make that fighting a big boo-boo somewhere probably hmm that just worked might have a little bit it's not I promise you I can't ask me one for help can I because this is this is Wow it's not let me type demo fail like that I'm actually completely lost over here I don't know what I've done so yeah it's the front module is missing it's not missing I can assure you well I thought it might be that but my documents over here tell me that lower case is fine this should be upper case there I'm almost certain of it by the it's not a firing the front module for module name well that's a nice nice error isn't it I mean there's a base 54 function over here it's called string takes one function turns on the function and I've exported it over here in shouldn't that shouldn't matter well you certainly can make a Mista for because in my here's what I prepared earlier that's exactly what I've got and in fact you know what this is why we do things like this we go talks over here and we go to pure script downloaded there you go and we open up demo too we check out master where all the changes actually exist over here we open demo - I'm a consummate professional I run main over here and we opened the code to see what I did wrong there's a main well as a main foreign there's an export-based for one can anyone see the difference in those two things I can't difference there's two things I might just I've changed that any other one - that's all capital well who knows I can only imagine I'm being daft in some way and who knows anyway let's just pretend I wrote that code correctly the first time and I run my make beans here it goes by saying things like hot loading work in this environment - still so if I ran that compilation process and reload the module the new code would appear inside that module automatically which is nice there you go obviously I can use that function now can I exports an example but so yeah I've been using Erlang code from your skipper code code I really hope I work out why are we wrong there because my next demo is all kind of revolves around using parent function imports so hopefully I get it right next time who knows let's go back to that as a team I'm sure you can work this out I mean there's a roomful of clever people here you'd think that would get this wouldn't wait so that is our demo just here we have cysts we have made that earlier main dot purse we have main dot LOV here I'm exporting a list of functions one of which is base64 slash one which exactly what things called over here and that a function takes up one function returns up I'm not seeing it I'm not saying I blame the demo gods I'm so leave it at that and hope they don't interfere my next demo I feel let's go with that shall we I said wait any more time on that it's really easy and works all the time and never works it expects because and work for no reason so purse merely transforms pers into L and technical play steps are required now this actually useful in some ways because it means whatever tooling you normally use for your airline you can using for your pure script obviously some people like to use all that mercs some people like to use Erlang Merc and some people use rebar dot three rebar three they're all dreadful in their own little ways and you know it doesn't really matter which one you pick why would you poison the module spin rates are no different from airline modules and side-by-sides just side by side closures code and hot loading and usually length features are all still gloriously possible let's talk about lecture code which means using foreign foreign file imports and just hope for the best shall we this is actually the I guess the biggest demo we have going so I've got a legacy legacy in code base here it's very important functionality as everyone those PM's like to ask for point ponies so we have a crate Pony here taking any name which a map which is a genius I've got a name which is maybe a string who knows I got is awesome it's always gonna be true it's boolean let's course they're always awesome aren't they we have only ponies not force in which the footage takes a list of ponies and returns a parent awesome and we have a lovely function here called right ponies to file so a very complicated of legacy code that I cannot possibly rewrite in pure script because there's too much hard work and I need to reuse this from my pure script land I've must have cover some use may use cases here in the simplest way possible let's go ahead and just start writing some code so I've got main dot purse over here they've never been compiled again so let's just go and do that demo three once again pulling packages over the Wi-Fi you know if demo gods were gonna smite me you'd think they'd do it here wouldn't you they're out rather than just arbitrarily getting in the way of my imports there is it's so subtle that I cannot see it after looking comparing the work examples on two different screens I really hope that I work this out right well I mean it's the kooky thing to do here is follow the pattern you would ordinarily with legacy code I've got module here called cool girls and we ordinarily do in pure script world when like rather than actually code it's create a module called kill that person and you create another module called curled up elf occurs leakin off too many cools can you once the application ones not as nice Senate create module here module cool we're an input curly because you can't need it importing those functions so let's go and look at what these functions actually look like crate pony let's assume names a string shall we an on item or something like that I think it's reasonable to assume that I probably work and go strings over here I'd create a function called crate pony and I take the string and I'd return it what am I going to return here there's a question you can't represent hedges maps in your script you can't have a a list or a map with different types of key value pairs in the houses it's not gonna happen so I'm gonna have to create an opaque type for this pony tank first something I can do so I can say foreign import data Pony which is of type type there is something called a pony and I'm going to I'm going to bring it out in this API and when I pass it around it's a pony and peers could have no idea what's inside that it just knows it's been called Pony that's fair enough if it wants to access the name or the variable add add functions to do that pony name and Pony is awesome fair enough that means I can do a pony give me a pony yeah obviously needs to get foreign import as well go and crate that module over here so here we go again let's just hope of workers time shall we so far so good right pretty pony thing well like I do is call the legacy module with the variable and return that map so we're lying about the type we're just saying it's a pony don't worry about it and getting on with life Farrell I'm not gonna bother running this I know that I spend so much time I've fixed the last one that it's not gonna really show very much here let's just try and cover the bases a little bit all right I only pony's not awesome well this is an interesting one because it takes a list now it doesn't take a pure skipped list takes an ER lined waste and the difference between those two things a pure skipped list is a set of Const data structures and Erlang list is a fundamental date type in our line so I need to use one of them I'm gonna call it Earl list just gonna call this an import damn thing takes a list of Pony and returns a bool plain gum own own type list let's try and port that shall we got a few options I can use the pure skip list I can use the airline list obviously it's the airline list and put that over there and you'll see immediately we have modules for all of the airline there types available for us in pure script land so when you're writing native pure script you'll normally avoid using the ER line datatypes when you're interfacing with legacy Erlang you'll use the ER line there types and there are functions to convert between the two in general you don't need to use them because you're either writing pure script or you're writing a line you're not generally mixing the two too much bottom there we go oh there's a boolean and pure scripts of course is there we go cool and that's nice and simple as well because anypony's not awesome news but cuz i have an earl i need a type there i can just pass it in use it exactly as it is and that will just work now the last one last one slight very interesting it could have a side effect in it my binges crashed that's amazing thank you so much yeah I've talked about talk to you Betamax many times right anyway I've got a side effect over here they are file right file I need to express that somewhat differently generally functions inside pure scripts are pure cues kind of in the name really and it means I can't I could lie here and say actually you know what write ponies to file takes a list of Pony and returns a billion I could lie and just call that file dot right and no be any of the wiser it's a little bit cheeky issue read side effects and pure script my sure to tell the above world but you're doing it so this needs to be an effect and we'll leave that as a billion for now and I'm going to talk about error handling once I've done this function because I don't want to muddy the waters too much what is an effect well the N word was used earlier I'm not gonna use the M word it is a function wrapping another function in this particular case and that's literally what's going to be underneath the hood it's how they compiled if I want to write ponies to files inside my foreign function import over here I'm gonna return a function from my function which is the effect and then I'm gonna actually call only C files ponies and that's all there is to when doing side effects so you have to be be cognizant when you are for stop there for stop there honestly it'd be quite cognizant when you're writing F eyes about whether you have side effects or not I need to be honest with yourself about whether side effects are not a call to a gen server is a side effect you're calling your remote process you know it you can't pretend it's otherwise you know your brake system further down the line so generally if you're doing anything that involves IO whether its internal or external you need an effect around it and that means taking the function and the code and everything how's it working I should expect to file rather than write a foot pilot code that uses this it's realizing the file name forrester it's not gonna work at all if only the Erlang would complain about that and that's got two in it and my pure script needs to also then have a string cool this will compile bubbly three that's useful error exports of unquote era t3 but imported to create our tea to export must have less than or equal arity well I've definitely messed that up haven't I let's go over look I put a three-inch lever - and it's a - I was looking at the air turn value in going that's a butter that's a fun but if I don't have to care about let's find the code that should be a to thank you compiler for checking whether it's doing things right or not followed by later so here we go again I'm not to find the phone module module cool you find it is it's just there I think I'm messing on the export function is it it's not thank you hey we have a compiling thing this time which means if I go and do I'll make beans as well as couldn't do that shall we nothing to actually run over here gosh you know it right Pierce but every single day for work it's literally my job and I still can't do it when it's on projector this is really quite terrible I guess right the bay bottom of the screen and I can't control l2 top apparently I'm so sorry about that I'll just press return was done wasn't done the result I can cause things like crate pony well I can actually look at the module I call the cool PS cool app yes dot straight pony there you go right I can see there that the types underneath there still I've got a map and things in it and pure script can pass that round quite happily but also I can bust our line till everything's fine and great if I would create another if I should stick that our variables and I can indeed still use my exported X or any ponies not awesome at the more types for that or any ponies not awesome faults that makes perfect sense there's no boolean trap going on here and indeed I can write I can write I can write these ponies to files so let's just quickly do that shall we I didn't call our participant that I once I call the people does doesn't it following gosh you guys are on the ball that's great let's call it follow texting bus complete lie ah what's this it's a function because I return a function so give me what you watch out for this when you're passing things around from pure scripts to Erlang and there are helper functions to help you this kind of thing to make these effect functions something that Erlang needs to know about but obviously I can just rub that in brackets and invoke that function and now that the file let's quickly go back to this again shall we and very quickly because it's important to note I return the fact boolean there and that's not a file right file returns file right files if you just use is rang some Erlang it's a peer script file file the right file can return and okay or it can return an error reason where reason can be an atom or a number of things you can represent that inside Purell if you want to inside you find import and best practice is generally to try and mirror the API exactly so here I actually say it's an effect and it's either an atom or it's a file right return results and then you go sit there and you've got define data file right that equals error string or error int and so and so forth and the if passes constructors into that function and return them so and so forth and it gets pretty burdensome when interfacing with Erlang libraries that are not the core ones and you're not only writing something over the thin veneer it's quite tempting to not do this and return something more pure proteins correct everything two strings or just a list one of something from an ADT and that's all possible and allowed and fine it's kind of up to you and it's also kind of undiscovered ground as it currently stands our approach so far when writing our code is to try and represent the errors inside our bindings to legacy code and handle those errors in pure scripts which means our pure script doesn't tend to crash because it's pure scoped so why would it ever crash you have types being checked now of course the Erlang philosophy is let it crash so you've got a bit Akata me going on here and it's kind of up to you where you draw the line between those two worlds when writing your bindings between the two environments there's no best practices exposed for this stuff yet kind of which one do you feel like I like to handle errors and not crash that's just me I like to log in to our servers and see an empty crash log and makes me feel but warm and fuzzy inside some people don't mind having a crash start log and the long innocent cousin were that's okay we once had a bug in production where we were crushing every 10 frames we received and no notice for six months until because I log directory ran out of space no one was looking at it basically and this isn't kind of working because the message got the message got resent and the frame got processed so who cares probably not best practice let's put it that way so anyway in summary FFI is importing I think using code you there's some limitations you can't represent the heaviness types very well that's okay make them opaque don't worry about it they're actually useful in between if you look at my OTP example that I had out earlier very quickly open my supervisor over here this ends up being a list of children with different types but two pure scripts that just child once you've finished building this child here it's just child I hide those types in the @fi underneath the hood it's convenient because the underlying rotation of the API has a list of random tuples the current just fit together so once you've done the type checking at this level there's no real reason to try and keep those types around so they're hidden they can make a list of them and that's such a useful feature if you like being able to actually hide those types obviously at your discretion obviously for a fact use effects which means wrapping of functions and functions cool whatever either surface your errors are don't annalistic approach does kind of help you all all locks in practice I mean I'm kind of running out of time here I've run out right I've ran out of time you've already seen it basically I mean you know us gem servers and things so that's not worry about too much I guess the structure of the application is kind of important get out of this this is a real application that song gets hope it's called demo PS and the ideas repelled the links in the presentation it's got a rebar config which calls us make file here which builds a server which is an application with an impure script it's just here it's got a client which is an application written in pure script for the client sides just here and the two's get built the Erlanger generated and the application is just this thing here which loads the pure scripts and the rebar three tooling works and the pure skipper tooling works everything comes together and everything's very nice and shiny you can go look at that in your own time spirit where the puerile dependencies can have Erlang dependencies so for example stetson which is our wrapper around cowboy good name needs the cowboy dependency Adams of rebar got config our JSON compiler simple JSON requires Jess X adding to the rebar compiler but the thing is when I stop working if I matched Charlie keeps crashing so got a script called reset now she brings it back sometimes but not this case that's ok because I've got I've got them ignoring that completely there I can see it the future so there is no illiteracy I'll go up and go story the best way is to clone a demo repo and then delete the code you don't want there's no worse than erlangs going start story really because also pretty terrible so don't about it depends he management is ugly but your Erlang so your dependencies are limited anyway it's like five of them in the world they actually use and practice bands of carriage at four anyway anyone he says is a liar and a charlatan but it's here and it works and we're using it to build your software today so I mean it is there it's great for what it is here the pile of useful links that will be available exactly takes this slides of your line anyway or already online you know what look that's it questions per the demos well I'm the time for that seen you outside and perhaps I'll just show you some real code rather than the demo code because I've got lots of it thank you very much for coming [Applause] you
Info
Channel: Code Sync
Views: 1,600
Rating: 4.9024391 out of 5
Keywords: Purescript, Erlang OTP, Rob Ashton, Code Mesh LDN, Programming languages, Purerl
Id: Lkh8nNwAEHA
Channel Id: undefined
Length: 47min 7sec (2827 seconds)
Published: Tue Jan 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.