Devreal

Cats - A fresh look at Pure Functional P...

Event: Scala by the Bay

SBTB 2015: Stew O'Connor, Cats -- A fresh look at Pure Functional Programming in Scala

Recording: SBTB 2015: Stew O'Connor, Cats -- A fresh look at Pure Functional Programming in Scala

all right thank you very much so yeah um we're here to talk about cats which is great because everyone the internet loves cats right but no it's what we're talking about is a new library for doing functional programming in Scala and so you know before we get started I'll talk a little bit about myself and I'll try to keep it brief like my name is really Michael O'Connor but no one except my mother calls me Michael so call me Stu and you can ask me why some other time I do work currently as a software architect at Verizon a project in there called on cue which is down in San Jose and we do a lot of Scala there we have big data little data all kinds of data and we're doing you know all of our back-end systems are in Scala and we're having a lot of fun and we're hiring so you know feel free to come talk to me if you think you might want to work with us so cats like I said before it's a new library for trying to foster pure functional programming in Scala I'm really excited because this conference you know for me it's great because we've seen like we said at least three or four different slide decks have seen people talking about natural transformations it seems like people are dropping the Monad word like ain't no thing anymore and you know lots of the the keynote speakers and a lot of the other speakers are talking about how they use scala zedd in their projects and i think that a year or two ago even you know that recently that wasn't the case and it was kind of like you know it was much more prevalent for you to find people who said I heard about that Scala Z stuff but I don't want that on my class path for whatever reason you know good reasons or bad reasons but now it seems like functional programming and the Scala is kind of come of age and it's it's something that's becoming doing it in the in the pure pure way that some of us zealots like to do is not considered so crazy so I think it's a great time for for this kind of thing to be happening and so anyway what I what I really want to do with this talk is kind of talk about where we are with the project what we're doing with the project I want to talk about why we're doing what we're doing and hopefully get you guys kind of up to speed with where we're at and maybe I'll entice some of you guys to come over and join us try it out and make some contributions but a lot of this I'm excited that a lot of this talk can kind of be I could start from the baseline level of we're here because we want to do this kind of pure functional programming so yeah so the first thing we should talk about is you know why are we doing this there is already Scala set out there you know I'm sure there's lots and lots of people in the room who are using Scala Zed as evidenced by the you know the people who are presenting material it's very popular these days and I you know I'm using it all over the place why did cats start a lot of you will know a lot of you will know bits and pieces of the folklore that's around the the things that were going on on the Internet when the cats library kind of came to be and a lot of those are kind of maybe touchy issues there were some social problems and it you know it would be I would love to be able to say that we made this library because we just felt like writing a great library but that would be dishonest and that you know it really did come out of some social problems that we're happening and around scala said i don't want to talk too much about what they were because it's just a way to get in trouble and i certainly wouldn't want to talk to about the things that happened when i'm standing in this position of authority on a podium and talking down to you people because you know there's a lot of different sides of that story and it's best that you know if you want to figure out what happens good luck but you know what came out of that is that we decided a few of us knew that you know from what was happening it was time to maybe try to start again and a new a new functional library for Scala that would sit kind of you know in the same area as Scala Zed but we really wanted to focus on primarily is the experience for other people who come to the library for the first time I'm sure that a lot of you who are using Scala said it probably wasn't just a hey I'm writing Scala I'll drop this library and start using it you know that the experience coming to Scala said is certainly not just like okay it's like a you know just like some other database library just drop it in your class path and start using it it's a if there's a lot it's a difficult library to approach and it was also there are a lot of well-founded accusations that it was a community that was hard to approach so one of the things we're doing out from the you know right out of the gate is that these are the things that we're putting as absolute paramount you know there's other things that we'll talk about more but you know I really want to get out in this talk and talk right out from the front and to say you know these things well talk about other things are important to us but I think these things are very very important to us is that we want to make a library that's improves the approachability of the library from a technical standpoint but really importantly we want to make a community that is approachable from just from a social standpoint I've pointed other people to a community which I kind of hold as a model for what a good community looks like which is the zero and cute community and I don't want to spend too much time talking about it 0 mq is a fantastic networking library it's a library that abstracts away how we connect different things together over a network fantastic library really pleasure to use if you were to talk to the founder of that library the guy who started the project and you said what is 0 mq it would be a long time before he got to oh it's a networked library the way he would describe 0 mq is it's a community that supports each other and together build stuff and out of that we got a good networking library but you know the core part is that it's a community and there's there some good I recommend you do some of the reading of the the founder Peter hinge ins I believe his name is mispronounce if you read some of the stuff he has to say about community I think it's a it's a model that I'm trying to push cats to be more like that as an as a you know a wholly accepting community and so part of that the thing I want to say is in interacting with the the project with cats interacting with people who are involved in the project if you're ever feel like you had a bad interaction or you know if something you get an answer from someone you don't like because you think they're being a bad player socially talk to anyone who is a member of the community and we'll get it sorted out quickly because we don't want things to go as far as they did with scholars ed and how bad the explosion that came out of that but I don't want to dwell on that too long so let's talk about what happened where we are so in January 20 2015 you know just about I guess eight months ago Eric who is seated here in the middle finally was the one who threw up a github repository and said here it is a new functional programming library and we a lot of us were kind of waiting for this to happen and we were all kind of anticipating that something was gonna happen we all kind of knew we wanted to write start from scratch and write some new functional programming library and it's just a matter of Eric was the one who finally threw a huge commit together and said all right I started here it is from then it was very clear that a lot of people in the community were really waiting for this to happen because once he did that you know the first week we had about twenty people show up and we merged about a hundred pull requests in the first week and that's just kind of that kind of momentum is something you don't see very often like how often have you seen someone be like hey I thought I'm gonna start a new library and put up a github and have like you know people just swarm to the project and be like pull request pull request pull request that's what happened and it was super exciting it's super fun the goals I talked about the goals I had about community and those are up on the slide as well but you know there's there's there certainly we have a lot of goals technically for what we want to do with this library and and I think that we're doing a fantastic job was starting to achieve them and and a lot of the reasons we're able to achieve these goals is that you know we're getting start from scratch you know and how often you get to do that we wouldn't get to do that with scholars ed because the scholars it has users so you can't you know can't just go and break everything and rewrite everything but we're getting this this you know opportunity to start fresh so some of the things we're trying to do is we're trying to make it you know we're trying to make it a tighter live or a smaller library we're trying to make it more modular and you know some of these things are you know a lot of this is trying to aid in its approach ability so we're trying to not to make it where when you go first : come and look at the library you're not blown away by you know if you go to like the the core directory of scholars and you see a hundred files in there of stuff that you don't know what you would do with and stuff like that so we're trying to cut out a lot of the stuff that we don't think needs to be there have just the stuff that we say I can't really work in Scala without having these things we're trying to make it more modular so we're trying to you know kind of make it so that you don't feel like you have to pull in the whole world and pull in a zillion implicit syn order to use the library so maybe to hopefully ease some of the anxieties for the people have about I don't know if I pull that into my class path if you're familiar with Eric and some of the other work he's done you know that he is very good about optimizations and stuff and he's making sure that we're trying to keep things very very efficient and but also go up and look at our github and if you look at some of the pull requests that we have there you'll see that he he jumps in on a lot of those but we have a lot of very very talented people that are looking at every pull request and every ping we'll pull requests you won't see any pull requests to get merged with are very few to get merged with a single comment there's a big discussion that goes on people are really looking at the stuff that's going into the library and I think that it's the fact that we have such people who care very very are heavily scrutinizing everything that's going in the stuff that's going in is going in is really solid and it's really really nice so you know one of the things that we focused on a lot which also plays up to the approachability of the library is that we're trying to document as much as we can so documentation was something that you know and this is something when we talk to other people about you know what was your experience introducing scholars ed into your code base at work or something and a lot of people the complaints would be you know there's no documentation or I don't know what this stuff is or it scares the other people so and in Scala's ed I had tried to I had put it in a lot I had been working a lot in scholars that are putting more documentation is but there's almost a kind of a reluctance for people to accept documentation scholars that there are people at the core of the scholars that project who are actually anti documentation but we're trying to go the opposite direction so we're I'm trying to make sure and we're not there yet but we're doing pretty good I'm trying to make sure that every method is Scala doc no matter how trivial are no matter how much you should be able to tell what the function does just by looking at the types or whatever you know it doesn't hurt to just throw a sentence in there for Scala doc so we're trying to make sure that everything is documented and we're trying to make sure that everything has examples again we're not there but you know we're doing we're doing good we're doing better than your average library we're trying as hard as possible to make everything serializable because that means that you can use in SPARC we've had incredible help that came out of nowhere for getting support in Scala Zed suddenly the scholars that community they're a bunch of workhorses and they're friendly people and they came along and just said hey I'm gonna fix this and make it work in Scala jjs and from very little work from us we're their last on the slide a search engine optimization one of our goals I think should be you go to Google you type in cats and you find our library okay so uh yeah that's not likely alright so uh and please at any time if anyone has a question I'm very happy to be interrupted at any time so if you have questions feel free to raise a hand and stop me but you know and we could we can stop and talk about whatever so having said that I thought I'd talk a little a little bit about what some of the things that you'll find in the library because that and I'm gonna do this I apologize with some assumption that you are familiar with scholars ed so if you're not totally familiar with scholars ed I'll apologize a little bit and you should get more familiar so anyway we have some type classes in the core of the project and it's kind of the ones that we have all the usual suspects that say you would expect or you would need are there these are the ones that you know these were the first ones that go in these are the ones where we said well clearly I can't do absolutely anything without you know some of these these are the ones I you know I use in you know almost every class file I would guess there are some that we are getting from the algebra project the algebra project is a project also started by Eric and what it tried to do is try to define some mathematical type classes which could be shared between spire and algebra which are two different libraries for doing math stuff and and the idea was that if we if it was it was people from Twitter and it was people from spire saying hey if we could agree upon just some stuff that we use in both of our libraries like what is a semigroup and what is a mono how do we add ends together we get this we'll get a nice ability for people to kind of fluently move between the two projects they can you know you can maybe take a result you got from algebra and it might be usable with an operation inspire so there's it's a it's a great I think it's a it's a great goal to have and so we've jumped right on there and so we didn't define our own mono into our own semigroup we just get those right from from algebra which and a few others like equality and ordering there are some things that we're missing that it's good that we're missing I think there's a lot of stuff in Scala Zed that's kind of there what I like to say is that it's there it's category theory for the sake of category theory it's kind of like well I know I could do this so I did it what would you use this for well no I just I just did it because I could you know and there is some stuff like in there and you know I threw up some random examples you know how many people in the room have used the right Khan extension when writing you know Scala code Vlad has okay so but you know these kind of things are you know and some of them are they're interesting exercises and they're interesting things and you can learn some stuff by learning what some of these things do but I'm not going to use them in day-to-day writing a scholar so you know a lot of these things we're saying unless you can come to me with a demonstratable use case it's not going to earn its weight in the library and it's better off to not have them in because these are types of things that you know when you open up a source file directory and you see these things called Khan and you try to read it and you're like you know it's just a bunch of single letters and I can't really tell what this is we're not helping anybody and all we're doing is possibly alienating some people who are ready to be alienated by too much math one in that list probably doesn't fit that category which is lens lens is something that's very very useful and something that people you know a lot of people in this room I'm sure have used lenses the reason it's not here it's not in cats is the same reason why I think you may find it disappear from future scholars dead versions down the road is that there's a way better lens library called monocle from Julianne Truffaut and the the general good advice out in the street these days is if you're trying to use lenses that's the probably the library should be looking at so I think we're kind of right now we're gonna say let's see if we can down the road get a version of monocle which will play nicely with cats and there's no reason to have our own lenses so coming from Scala said there's a there's a few things we're taking this opportunity to kind of say maybe some of these the the names of some of the structures we know we're gonna bring over from scholars ed or we're going to re-implement from scholars ed we're kind of this is we're at this perfect opportunity which you don't get to a lot of times where we've got no users and we got this chance to kind of rethink some of the names so up here I listed most of the the the blatant renaming that we've done when we move stuff over from scholars ed so people a lot of people are probably familiar with semigroup and mano there were structures in there are type classes in scholars that called plus and plus empty which are just like a mono end but there are mono over higher kind of types which is so we decided that we should show how they're closed they're related to send a group in mono and stick a K on the end in order to to note the fact that they're higher kind it and because I think a lot of people I think a lot of people missed that connection and similarly I think the others you know we just the others aren't really too much worth worthless dwelling too much on but just you know we went through and and you know found some names which I think were are easier for people so for instance bind is something that scholars ed it was originally implemented it was something is stolen from Haskell or you know borrowed from Haskell the bind operator is what you is the name of the flat map so we just said why would we call it bind one I call it flat map that's what people know you know the ones out the bottom or are you know that is is these these are the type of things that those are like the one on the bottom right that the backward slash forward slash is one that people very quickly end up using it's Gaza it's a just it's a disjunction it works like an either and the scholar standard library but has some differences like it has a map and a flat map method that assumed that the good value is on the right and that's a very very useful class it's one that you'll you know you'll find itself using all the time if you're using scholars that but we thought but a lot of people get turned off by the the it trying to masquerade as the the mathematical disjunctive symbol so we renamed that one to you know exclusive or we thought that was a little bit more approach you know and because well we we a lot of again I prefer honestly the backslash /one just because I've gotten used to it but and a lot of us I think who worked on the cat's library agree that this is the one we prefer this is the way I think about it but when we say when we talk to others when we say okay when you try to teach teach this stuff to your co-workers weird how do they like it and the answer is that they don't like it so this is this is this is a great example of where we've said you know we're not necessarily writing this library just for us we're writing this library so that we can attract other people to this style of programming and so you know that that's a name that people you know people look at that and they can get X or as exclusive or and it's something that's a lot easier to digest aside from type classes we we have some data types that we add and you know a lot of these are all type classes which are or I'm sorry these are all data structures which exist in scholars ed there are some of them have been renamed we have one end which is a way to get a non-empty list or a non-empty vector a non-empty stream a non-empty set X or is our exclusive or again we have a monad transformer for it the validated is our renaming of the validation type class data structure which I think a lot of you people are familiar with and there's going to be more coming we have there's some that we're notably missing we don't have we have a reader Mona but we know of a writer monad our wst is like a reader a writer a state all packaged into one which is very handy and these all the things on the slide are you know you might say why don't we have these and these are not things that we're missing because we think that they shouldn't be in a library it's just I think that for most of these things we just haven't gotten there yet the the last two on the list are kind of a sticky one task hopefully a lot of you are becoming familiar with tasks it's a really great it's a really great thing in scala zed it is it is kind of both its wrapped around scholars its future and it is also an effect capturing monads so it's like the i/o monad in haskell it's a way to returned a pure computation that has this method called run which says you know there's some side effects in there if you want to run them and it's it's great for controlling where you have side effects a lot of us who work on the cats library used this to this type extensively I use it almost anywhere everyone anywhere I would normally have something possibly it was a returning unit it's going to end up returning a task of a unit and this for me this is one thing that keeps me from personally being able to use the library as much as I would like to in fact I'm not using it much at all because I have to have this type process is the main type is the maybe the central type in scholars edge streams which again is a fantastic library a lot of fun to work with and it's one that I use very very extensively both of these and this is one that I get asked about all the time is what are you guys going to do about that there's a lot of I think there's a lot of hope that you know there's a lot of people who think that tasks could use a rewrite people have talked about a rewrite of tasks and I think people are kind of waiting to see if that'll happen the scholars edge stream there's a currently an open issue that got opened I think three days ago or four days ago on scholars at stream or Paul chiisana the original author of scholars edge stream has said I'd like to pull tasks into scholars head stream and pull scholars that stream away from scholars ed and then there's the understanding is that then once scholars at streams does no longer has a dependency directly on scholars ed we can start to build in a scholars ed compatibility and a cat's compatibility so I think a lot of us are kind of sitting back and waiting to see what will happen with this rewrite and pray that when it's done we have a working version of tasks and a working version of scholars that's dream because again a little for a lot of this a lot of us who would want to use this library these are kind of must-haves for because you know you need if you need to affect capturing and if you're going to do pure functional programming okay so there's a few there's other data structures that are in Scala Zed which we're declaring Attis cope and so a lot of these some of these like I list in maybe are I list is a rewrite of list from nil it's it's a replacement for Scala collection and immutable list maybe is a replacement for option and these are ones that were added in Scala Zed for a couple of reasons one is that they're invariant because covariance can you can you can make arguments to say that the covariance and those types can can be the trigger for some bugs and also that we removed some there's some options there's some methods on there that are missing from list an option like you can't call head-on an eye list because it could be empty and it's a non total function you can't call get on a on a maybe because it might be a nun and these kinds of things we're trying to make us safer and these these are and some of the others on the list the equals equals greater than greater than is there map D list is a list that has a constant time append and just you know these other stage of structures they're nice to have they're ones that I wish I had some of the a lot of the time but we've just just decided that this they're not really they're not something that's necessary for cats and in in the idea of keeping the library small we've said they belong at some other project and it's just no one has had the motivation to start that other project yet but I think it'll I think we'll see it I think we'll see it not too before too long so I talked a little bit I mentioned before the modularity you know one thing that we're trying to do is we're trying to see how we can split the split things up and so you you know you don't necessarily have to have the huge fat jar that the Scala said is we'll see how we maintain this I think actually and this is kind of talks about how fast the projects moving since I wrote this slide I believe the standard modules was wrapped in two core right yes so we don't have a separate standard module but we have so corn standard are together now they're the one that contain you know the core types the type classes you expect and the data types we talked about the standard stuff which is now part of core is like the implementations of these type classes for the standard library so stuff like a monad for list or a mono I'd for option we have a project of laws where we're doing all what we're doing all the law checking and the law checking is something that's really important it's something that gives you a lot of confidence when you're using libraries like this so maybe I'll talk a little bit about that so for example hopefully a lot of you are familiar with say a functor and a functor is basically a data structure equipped with a map method so I'm gonna assume that a lot of you are familiar with map on a list and that's so you have a list of A's if a map function that takes a function from A to B and it turns your list of a into a list of peas I think we're all familiar with that the functor says that you have some some type you have this map method but that's not enough the other thing you need is you need it that the map method needs to follow some laws it needs to follow a composition law that says that list map F map G is exactly the same every time as lipst map F and then G you know we can do these kind of structural rewritings and be guaranteed that we haven't changed the the change our program having these laws allows us to treat our code algebraically which is a it is a huge huge win for for doing code refactoring and just being able to reason about your code and that's something you know you'll hear that you know that word algebra thrown around a lot I think it's worth spending a few seconds talking about what we mean I think about when you learned algebra in high school you might have an equation like 2x plus 1 equals 7 and then you you learned it because because everything we're promised has this promise of everything being well-behaved we can say well I can subtract 1 from each side and get 2x plus 6 and divide each side by 2 and get x equals 3 you know this is what we call algebra and what we're doing is we're not you know without knowing anything about the X other than as a well-behaved number I can you know apply rules and manipulate the symbols to get to learn new stuff about my code or get our new rearrangement and this is the kind of thing I want to be able to do with my software I want to be able to look at the code and say I have F map F I'm sorry I have L map F map G I know I can take that and make it L map F and then G and I didn't change anything the only way that this stuff works is when if we can guarantee the things are lawful so we've put a lot of effort into for each of these type classes anytime we can define meaningful laws we've defined them we've defined a lot of them and then we're using some tools that hopefully we'll talk about later which you know which go and check and make sure give you ways also of checking when you if you have your own data structure and you say I think I can make this a functor all of them it functor we will use Scala check to test and make sure that your functor actually follows a law so you can have that confidence of doing that refactoring or that that's symbolic manipulation of your of your program we have a Doc's directory and that is we're writing we're using the tool Tut which we'll talk again about more we're using SBT site and we're using SBT the github that github pages plug-in so what it means is that we have all the docs for our website all that in in the same branch of the source code it's a lot easier to maintain than try to maintain a separate gh-pages branch but with the the really important thing is that as part of our regular build so that anytime we're building the project we're also type checking our documentation and we're also publishing fresh that's the documentation all the time the last two free we've had a lot of we've had a couple talks that mentioning free it's a really fun way of structuring programs we kept it as a separate module because you know you'll see a lot of but a lot of people starting to play with this and it's something where once you start playing with you start thinking about you know this is really cool and it's a really neat array of writing my programs I bet you I could make it more efficient we're doing a lot of allocations and you know you'll read you start searching around from this and see that of course oleg wrote a paper about making this more efficient like a dozen years ago but this is somewhere we expect there to be so and some room for rapid improvement so we kind of kept that separate so that that iteration can happen without kind of in a separate little place so we kind of kept that separate for now state ended up landing outside of core state is a state monad you can read up a lot about that it's there's lots of examples of how to use a state monad our state monad is just a state monad it's ended up living outside only because it depends on a trampoline which ended up in free so hopefully we very this last week a least rudimentary trampoline landed in core so maybe there's some hopes we could move state back into core I talked already about cats course so I'll I'll skip over that other than to say talk about what things did make it into cats core so again just like in Scala Zed we're trying to be adherent to or we're trying to be you know very much cognizant of what types are lawful as I mean what you know which of these implementations are lawful so you know we talked about the functor before and and you know whether or not to have a valid functor you have to have this compositionality law holding it similarly with like a semigroup where you're taking too you know well I won't talk about semi review but we've tried to to to take some account of the same position of scholars that didn't say that if things are not totally lawful we probably don't want them in scholars ed I mean in cats and some of these things some of the notable ones set being a functor or seek being a functor these are things that you know before you've read too much about category theory you might say well I don't know set seems to have a pretty valid map method go if you want to go read some interesting stuff go read on the internet if if set as a functor or not you will find lots of people on both sides that equation but we took the we're taking the I think which is the well accepted view that it is not a valid functor in scala through your standard encoding z' and seek it being one where it's just hard to reason about is that when you get seek is at a mutable structure is it a new butyl structure you know if I append to it how long will that take it's something you can't really know with just a seek in scala said I created at some point an outlaws project called Scout Liske a lousy outlaws and it's it was kind of a place where we said okay that's not a functor but you could totally map over that thing so here you go you know so here it is we're just gonna live in some other project where you kind of have to know you know you know you have to kind of go anyway so like I got I had this extra project and I know what that means I means I'm giving up maybe some of my safety but I really just need to map on that set and so for us we I think just in the last couple weeks Eric created a project called alley cats which will be our scholars that outlaws one good thing about the name which I don't necessarily like as cats is if there are a lot of good you know the sub-project alley cats is great it was almost called stray cats I think there's since there's some good things out though we can do so anyway one thing that we did maybe compromise a little bit out is that we do have a mono I'd for a double on a ma night for float and those those of course are not lawful because they are not associative if you have three floats a B and C a plus B plus C is not always equal to equal to a plus B plus C because floats aren't real numbers their ranges but I like I really like what Eric said in one of his talks on spire was like and I think it's a great attitude is that this is this is this is a place where it's like alright I can't get you off your addiction to floats but at least I can give you some cleaner needles and so you know I think this is a good example of somewhere we have decided that maybe it's okay to relax our standards a little bit because you know this is this is this is something that these are things that you know okay you give up some laws but you're gaining a lot they do they do earn their keep kind of as as things that are useful enough that it's maybe worth breaking the laws a little bit I already talked to a little bit about free I don't spend too much more time talking about it but this free that the talks you saw from earlier in the Esther day and today about using the free monad to implement you know and algebra and an interpreter or multiple interpreters to get your job done using the tricks the Co you need a trick to get you a free functor all that stuff is all available and ready to go and cats as far as I know so so that's fun and hopefully we're gonna see some of that stuff soon okay any questions before we move on yeah so so the question is for the things that are unsafe do we namespace them differently or give you some some way of knowing I so I think that the I believe the only two outliers we have right now are the the ones that made it in are those two that I talked about them on I double the my line float does anyone else know of one I miss I'm not thinking of I think that's the only unlawful thing and it's it's at the mono is not associative we also have an equal equality instance in there and testing equality of doubles is a as a place for pain but right now those two we haven't done anything special for namespacing them the rest the things like a functor first set and stuff like that that will all be names based through the fact that you're you're gonna have to pull it out of the the alley cats and that that'll be in a different you'll know it'll the fact that they're in alley cats is the delineation there the question is is it a different import when you're coming from alley cats and eric says yes okay so another fun thing that we were able to do when starting up this project fresh is we really able to kind of like use all the cool sometimes new mostly new newest tools in our and our stack like a pilar plugins and SPT plugins which made a lot of the stuff we're doing really a lot better so I wanted to spend a couple minutes glazing over some of the other things we brought in which are kind of really fun fun new toys to play with this the first one kind projector also from Eric is one that's been around for a while I think it's been around for this to nine and it is stable I've never heard anyone having big problems with using kind projector I think there's some hopes that that could make it into mainline Scala someday but what it is and a really kind of move over this one really quickly but it's a way to get rid of the scary type Lyme disease you might see or you might have gotten used to seeing in scala said i have a bit of an example that this so what you really want to do here is you wanted to find a monad for our exclusive or instance and that's one that takes two types right and a monad expects the type that only takes one type right it wants like a list of a a option of FA but exclusive or like a map has to type parameters it's like a a or a B and so that doesn't work the top line won't work because it's gonna say I expected something with one type hole and you got two there so what someone discovered you could do I believe is how it went down to which was Jason Zog is that you could write this crazy incantation in the second line which says create an anonymous structure define a type a alias that fixes one of the two types extract the type alias so this gets you this gets what you want which is gets you a monad for an exclusive or we're only the right type parameter is the one that varies but that line is kind of a nasty thing and that that's one of those types of things that scares people away from scholars edge when they see this stuff and so you know I'm running short on time but the the punchline is that at the the second or last line is what the way we get to write that using a kind projector is that we get this special syntax where we drop a question mark where we want the hole to be fill on the other hole and under the covers that's rewriting that type lambda for us discipline is another is another plug-in that we pulled in it's it's come it comes from the type level project it was started by Lars who used to be the maintainer of scholars ed and it's one that makes our law checking like super nice so when we're writing discipline code here are the functor laws i talked about the the one at the bottom a bunch of times which is that map FFG is the same as f n ng so we get to write it just like this we're just have this double ended arrow point between the two equivalent structures and this will basically enhance scala check to be able to know how to test this for us it'll invent some you know it'll bend some data pump it through our functor make sure that that equivalence relationship holds i think michael hillquist yesterday and his talk talked about simulacrum simulacrum is if you're writing type classes simulacrum makes things super duper nice it kind of takes all the boilerplate that you might want to write to make interacting with your type classes really really painless this is this is this is our definition of a semigroup it just has one combined method which says give me two ways I could smash them together make another a we add these two annotations that say that this a it's a tight class the center adaptation that say we want a shorthand notation for our combined method to have this pipe plus pipe it takes that this definition writes all this boilerplate for us and this is all stuff that any all-over scholars said this stuff is all written by hands what it lets us do is it lets us interact with the with the the type class and a lot nicer the first line is show that we're just able to talk about a semigroup int and it goes out in the implicit scope and goes and finds it and conjures it for us if it can it's the second interaction says shows that we're able to use our inline syntax so that the the one has been wrapped by a thing to bedazzle and add the extra methods on to it and we see that both the we can use an inline form of both the the combined method and the pipe plus pipe next one is that the documentation is something that I've been focusing on a lot is to say is to make sure that our documentation is as good as it can be so we're using a bunch of tools you know doc it takes all our Scala doc for all the different modules complies it into one big file SBT site and SBT gh-pages or help us to be able to push things to to github easily Tut I want to you know Tut was talked about a lot by Rob who authored it I don't know if he's in the room give him a pat in the back is a great tool it lets us write examples like this which get compiled you I like to say your markdown gets marked up gets compiled into a rebel session and this is the thing that lets us make sure that our documentation at all times is compiled able so again when you see examples on our web site you know that you can paste those examples right into your repple and they're gonna work because if they didn't work they wouldn't type check so lastly because I see that I'm getting the hook because I'm running along on time I want to talk just really briefly about you know you know is this project ready and I think yes it's ready for use other than the caveats that you know you might be missing some things that you're hoping for like a like maybe a writer or maybe like a task the project out there using cats right now there's one do I know if it's this project which is Travis's rewrite of Argonaut to move it from Scala said to Kat but I expect that were this is like the fact that someone from Twitter is taking on you know and and starting to actually really use it is is I think we're gonna I think we're just see the momentum go and I think are gonna start to see projects start to pop up like crazy little starting to use it because I'd really do if you look at the codebase it's very mature like I said there's tons of scrutiny going into every commit and I'd really do think it's ready for primetime even though there isn't much primetime that's using it so getting involved in the project check out we're very very active on gator we're very active on github we're using all the features of github like issues and we're tagging our bugs look for bugs that are tagged for low-hanging fruit bug bugs that are tagged as ready a lot of those are gonna be documentation which is a super easy way to get involved you know just find a method that's missing a scala doc throw on a pull request find us on gator we're very active we're very friendly I'd love to see you join so if I have time for a question or two don't have time for a question or two but I'm around but I