 So thanks. Yeah, my name is Raichu. I'm one of the people who occasionally hack on the address compiler Yeah, and today I'm going to talk a little bit about programming with dependent types and address So this talk is for people who don't really know what dependent types are and are curious about it If you know what cock is or acta, then you will be probably bored So yeah, I can't help it. Maybe there is something new for you. Who knows? So I will be talking about obviously dependent types and a thing that's called the curry Howard correspondence one question. Is this large enough? No, okay, let's make the bigger Better, okay so a Thing that's called the curry Howard correspondence, which is in my opinion a very powerful mental model to reason about types as propositions So we'll introduce that and I will talk a little bit about constructive logic And how we can model this in the type system so we can have more expressive types I'll do a little bit of live coding and Hopefully everything will work out right. I don't know sometimes things fail. So please don't laugh at me And in the end I will talk about effects and type providers So it is a purely functional programming language Therefore we have to have some mechanism to deal with side effects stuff like I owe Riding to files communicating with the outside world stuff like that and we reflect that in the type system and Another thing is that which is a pretty nice thing is type providers So we can do side effects on the type level that might sound a little bit weird if you Yeah, work with languages like C++ or other ones Why should we have type system? Effects on the type level, but I hope I can convince you that this is a pretty nice thing to have So what is it risk? It is a purely functional programming language that is developed by Edwin Brady It's developed on GitHub and so you can download the code go crazy with it simple requests That's what I did. It's a lot of fun and it's currently intended as a research tool So please don't use this in production. I've seen people who wanted to do that I wanted to do that too, but you will figure out pretty quickly that you shouldn't do it So, yeah, it's a purely functional programming language if you're familiar with Haskell or similar languages It will feel pretty much at home to you Of course, it's the penalty type. This is this is why we're interested in it and the syntax is pretty close to Haskell So some my new differences here and there Of course different semantics, but we're not going to talk about that too much here What I find particularly appealing about the languages is that it's it focuses on general-pocus programming So if you've got a system like Cog or Agda, it's more like a proof assistance So you want to prove mathematical theorems or theorems about your software and Cog or Agda But you don't really want to write a web server or similar stuff in that that gets a little bit hairy So this is actually one of the major selling points of it is in fact these slides are written in Idris They're compared to JavaScript. Well, that's the project. I've been working on for a couple of years now So you can try it out and write some JavaScript web applications or Node.js if you don't want to write pure JavaScript, which is yeah So another thing that's pretty interesting is is totality checking so we can check if An algorithm actually terminates That might sell a little weird as well because halting problem But if we don't have things like general recursion and just reduce ourselves to use Printed recursion then we can actually prove that an algorithm terminates We also have interactive proving with tactics. I'm not going to talk about that, but it's there Obviously, we have a lot less tactics than Cog which has an insane amount of tactics So what's the motivation? Why do we want more expressive type systems because there are a lot of very exciting types themselves out there So I gotta make this smaller, but only for this slide. Excuse me so Types are a very very effective way to keep our program behavior in check so we can Guarantee that some things don't happen at runtime when our type system is well checking all these things So you got to have a function that you can guarantee that this function only gets an integer and not a string that's pretty much The least thing a type system can do for you, but it's something so When you have a very powerful programming language, so this is not interest This is C++ which has a very very powerful type system the template system by itself is Turing complete. It's completely insane and So in this example, I'm I'm just trying to model a conditional branch Something like if then else on the type level might seem a little bit contrived But we'll get to an example where this is actually a useful thing to do So You can see this is it if that else is a pretty simple thing, but just to have it on the type level We got to write this weird code over there And that leads to a very interesting observation that when you are programming in a satellite type programming language You're usually working in two different languages. So you're working in the value language that you Program most of the time and so you write all your programs on the value level and you've got the type level language That is used to program on your type level and that's a completely different language You have to learn two languages you get two for the price of one which is not very good Because you have to duplicate a lot of stuff that you want to reuse on the type level like this conditional branch So we want to unify that we just want to work with terms and that is something where dependent types become quite handy especially it is So what are dependent types? This is a little bit of watered-down view of what dependent types are This is not like the full-blown whatever lambda cube yada yada yada stuff So this is just very very simple if you want to know the whole story read up on the lambda cube on stuff like sorts and Kinds, but I just want to give you a basic idea of what this is and first of all we got to talk about what a dependency is so We can have values that depend on values That's a pretty simple thing. We do that all the time. That's a function So we can write a function we could put a value into that and we get a result and the result depends on the value That we feed into the function That's a very simple function over there. That's the increment function It just takes a natural number and gives us a natural number. It gives us the successor You can see that the up there. This is Excuse me, so this is the type signature Gonna make this a little bit louder so it's better and This is the implementation. So it just takes an argument x increments it by one. So very simple function Another thing that might be interesting to you if you don't know programming languages like Haskell We do function application just by saying nothing so no parentheses. This is function application. So normally you write f parents whatever We don't do it that way. So that's some sort of dependency that we want to have we want to have values that depend on values obviously So another thing that might be interesting is we want to take types to values so Think about the identity function the identity functions. It just does nothing. It just takes a value and returns the value on modified So when you have a lot of types you have to come up with a lot of different implementation of the of the identity function Which is pretty boring So you want to write one identity function that binds them all So you want to have a type as an argument and then it returns a function that can deal with these things So in this case we just take a type a as an argument and we return a function, which is a value from a to a So Here we're using that So it takes net net as a type of natural numbers, which is just 0 1 2 3 yada yada and We turn it on modified. So what's interesting about this is that you can see we do type application Just the same way as we're doing it with with values So there's something weird going on if you've got programming language like C++ you have these angle brackets or Scala You've got square brackets to type application here. This just feels like a value This is we're starting to get into the realm of what it is is really about So another example is just the same thing with strings So another thing another dependency that we want to have is want to have types that depend on types So think about data structures This is this is a linear list and we want to build linear list for every type so List as a type constructor it takes a type and it returns a new type So can take list feed in string and you get lists of string and this Construct this type is to constructors. It has nil which is just the empty list and this thing is pronounced Cons we just we can't take a value take a list Put the value in front of it and we get a new list. So we're inductively generating that list So here is an example. We just have the list one two three four and we end with the empty list That's a little bit clunky to write because we're using this special kind of syntax over there. We can use This very convenient list syntax to to express that. So this is constructor overloading. We can do that for pretty much a lot of things so In case you might notice this little single quote. This is just part of the identifier This is nothing special. This is just so that I don't name clash with the actual list in the prelude So, yeah, now we've got three different kind of dependencies So there's just one thing missing and that's the thing that you're missing in most of the programming languages where you've got Where you can take values to types. That's that's the new thing That's this is what we what we mean when we talk about dependent types. We can have types that depend on values So this is a string that a string vector and this vector is just it's basically a list But with the length in the type So we are we have additional information in our type that says, okay, this this vector is of length 4 or whatever so obviously the empty vector is length 0 and The cons case it takes a string a string vector of length n and what we get is a string vector of length 1 plus n And what's interesting about this this plus this is not a special type level plus This is the same plus that we're using on the value level. So we've got a lot of reuse here So whenever we've got a function that we can use on the value level We can use that on the type level as long as it's total and yeah So This is just an example. It's a string vector of length 4 I have four elements if I were to delete one of these elements and obviously wouldn't compile anymore complain Hey, these lengths don't match up Okay, this is too large We can have a cake in needed to we can build a vector That is generic. So this is just the same thing string vector isn't very very useful because we can only put strings in there So we don't want that we want a vector for everything and we also have that in prelude. So this is a vector This is the this has got the same constructors as the list before it has the empty vector with length 1 We also got cons. This is the same story So now let's implement something that uses that and in this case we want to implement the the append function So a pant takes two vectors a vector of length n and the vector of length m and the result is a vector of like n plus m So the type tells us a lot of what's going on here It's it's a little bit different like the pant for list where we just take list a list a list a what does it do? I don't know Could just throw away one of the lists So here we are implementing this function in case the left-hand side is the empty list empty vector Excuse me. We just return wise If it's the cons case, we just take the front element We have we put it at the front and we call a pen recursively so we just Go through the list put them together and voila So there are two vectors one with like four another one with like four we put them together Obviously higher mathematics length eight and that compiles great So, okay, that's that's the view what what? Dependent types are what can do with them now. Let's put them to use and Yeah, I want to talk about the curry-hoer correspondence which Well, it brings us into the land of logic So there are a lot of logical connectors out there and or not whatever and They actually they have Well a corresponding type on the in the type in the type land so When we look at something like this this this looks very weird, so this is a type Type with numbers and equal sign. So we call this this type propositional equality and and We can only construct it if the two values on on these equal sign are out of the same thing Obviously there are by definition 23 equals 23 so we can construct it. This is a comment This is just a little pseudo code that I put up there so you can imagine how this looks like so it takes two arguments some time something AB and we can construct this if Both sites are equal And what's what's interesting about this is that? 23 equals 23 is all our is a logical proposition. So We say this and we want to prove that and whenever we write a program that satisfies this type We've got a proof. So a proof is a program is a proof It's not just a simple program. We can really use programs as proofs and And this gives us a lot of interesting possibilities when we want to do something like test-driven development called type-driven development where I come from so you can really write types that Do an exhaustive check so you can say for all this holds for all values of whatever This is a lot better than just a test which is pretty much an anecdote So I know some values where this works out and you can do this in an exhaustive way so So since we've got logic we want to have something like a truth value This is a very trivial case. So we call this type unit and just has one constructor So it's always true whenever I say I want some value of unit. Here is the proof It's just a simple empty tuple Won't be using that but just for the sake of completeness Obviously we want to have a notion of what's false So I said that whenever we find a program that implements type signature. That's a proof So when we don't have a proof then this thing it's got to be false. It's an empty type We call it an uninhabited type So void has no constructors. We shouldn't be able to construct that sometimes there are bugs in the compiler Think recently the cock people found something where they could prove false happens all the time it's It's software it still fails, but it's pretty early. So it's research So, okay, this is the empty type One have another thing which is called conjunction So when I want to prove a and b are true I want to give a construction for that and so once again, I'm using propositional quality there these things are trivially true 23 equals 23 yada and This is the proof for it So when we want to prove that two things are true just give me two proofs give me the two proofs and put them together in trouble So where it's and there is or? We've got something that's called the either type or some type in this case It takes two type arguments and it has two constructors either a constructor for the left type Which is a or a constructor for the right time. It's it's it's a tact union if you like to say that So another example, this is obviously true and this isn't But we've got a proof for this proposition because we can construct this value. It's like an or one of these things art is true, then we can construct the whole value and This leads to some very interesting conclusions with logic when you've got the law of the excludes Exclusive middle where you got every proposition P P or not P is always true That's a problem because there are unsolved problems P equals NP true or not true Which proof we don't know we can't provide a proof because we don't have a proof for it and we have not a reef We don't even have a refutation So that's a problem and we are going to deal with that So next thing implication so when I've got a proof of something I can transform it into another proof So this is once again. This is a very very trivial example So when a is true it implies that a is true big deal and This is what this type signature says. It's a very trivial theorem, but it's it's a theorem less so This thing over there is just a lambda If you know JavaScript, it's when you write function parents x parent yada yada lots of stuff We just write backslash. We thought it was better than just writing function So here we're using that Pretty simple once again. You might notice that we're not stating a as a type argument that is It was configured that out. I was a little bit. Well noisy in the first example. So Here you go So now it's getting weird now we're getting into the penalty type plan since we want to have something like a predicate logic We want to have quantification universal quantification Existential quantification and this is the unit for a new universal case So it's just a generalization of the function space. So Here the return type actually depends on the value that we feed into the function So we this you can read this one is for all natural numbers We can say one plus n equals n plus one. That's might sound trivial, but we need to prove that mathematics So natural numbers are defined inductively. It's either zero or a successor So in the zero case, we can say, okay We can fill in zero up there. We see one equals one. Okay, reflexivity with one next thing We pattern match on the next case. I want to using here is I'm calling plus s recursively and I'm using rewrite to rewrite the Goal, it's not that important. I can show it to you after the talk, but we're not going to into depth So this is approved by induction So the stuff you learn at school and I never understood in school, but I understood with dependent types with word So it feels natural. I don't know So just for the sake of completeness, we've got existential quantification We're not going to talk about that, but I just want to fill you in on this stuff So recall the vector the vector has a length of some natural number and When we filter that so we've got a Boolean function here that looks at every value and figures out This is true or false and we throw out elements if there are false So we don't know what the length is, but we know there exists some natural number That reflects that length Um, we use this kind of weird tuple there. It's called some people call this a dependent tuple Some people call it a dependent product. Some people call that independent some it's horribly confusing. I like to call them Sigma type Yeah, very helpful So yeah This is just we can say okay We can filter this and we know their extent there exists some length if we filter the empty list It's obviously going to be the empty list if we filter Some cons case that we call filter recursively and we go through it either this is true Then we increment the length by one. Otherwise, we just throw it away and we don't keep track of that So this type checks as well So last thing negation I hope I'm not borrowing you so So this is negation we want to say when something is not true obviously two equals three is Not true. Yeah so Here I'm convincing it is that this is not possible when I'm saying okay, refl. This doesn't work Refl is not a constructor of of two equals three So we have to convince address at some point that this is not going to work. So this impossible keyword helps So whenever we trying to say that something's not true or negate something We just say that this proposition implies false So it's a function. So you have we have to map every value in the starting set to a value in the in the in the image even sure. Yeah so If if the domain is empty that we can't map it Then then we can map every point But if the domain is not empty and the co-domain is empty We've got a problem because we kind of map these types. We cannot build this function. So this is what this negation stuff is about And now we're going to use that as I said before the law of the excluded middle says that Every proposition is either true or not true Which is a problem when we've got unsolved problems. So When we want to negate that we would just say not this is not true Which would be a very big problem because then we couldn't decide decide if something was true or not So we in this case we're saying not not and that's not the classical not not in in classical logic Not not a is a so this is not in it's not that way in constructive logic So what this is saying is say we do not refute the law of the excluded middle. We cannot assume it in general Which is a very important distinction so This either a not a is So popular that we got an own type its own type We call it deck for decidable and we will use that in the example So life-coding watch me fail So let's write a new model. We call this demo and And Yeah, so I want to introduce you to a nice little Data structure, which is called tree and it takes a type And it returns a time So it's got two constructors got a leaf and branch so tree of a branch and It takes a value of a Takes the left-hand tree and the right tree and returns a tree. So this type text So we can type chick this in in in vim if you're using a max. There is a great emacs mode So everyone's served here so Huh, excuse me is we just have to lift just have to leave it's Just a leaf leave branch leave branch whatever so you can take an empty tree is just leave Whatever. Yeah Yes, it doesn't have a value therefore we can think of it as a little empty to you so Let's build something that we call zip with and We've got a function from a to b to see and it takes a tree of a and a tree of b and Returns a tree of C so we put them on top of each other and just Well apply the function to all the pairs So yeah, I Can say give me a definition. So this is one of the ends. This is the interactive stuff that I was talking about Need to do something I need to help the compiler a little bit here. Excuse me So, let's be so I'm just telling you this please choose these names because it was as charitable at choosing names It's horrible really trust me. So what I can do now is I can do pattern matching I can But in this case I can do case splitting. So give me all the cases that T1 can have It and can have two cases can have leaf or branch. So yeah, cool. Let's Keep going. So case book. Okay. This works Okay, um these things are called holds on our meta variables It's a part of the program that we didn't write yet and we can ask Idris What type does it have? So this is what we know We know these things. This is what we want to get So can I can ask Idris, can you solve this program? Can you solve that for me and in this case it could but What happens if we got this case? so we can throw away data that might be The tactic that we want to use in some cases, but in other cases that might be bad because we're losing information We don't want to have that so This is this is kind of bad. We we don't want that. We don't want these two cases to happen So because we're we're losing information here So what I'm going to do is I'm going to introduce new type which is called tree shape and it's just a type and Let's call this a leaf shape Which is a tree shape and the branch shape We'll take the tree shape a tree shape and That's a tree shape. So this is this is the shape of the left and right branch Let's float this one away and Take a tree shape here So this has obviously leaf shape this has some shape s some shape s prime and We'll take a branch shape of SNS prime. So, yeah Once again zip with See So now I'm ensuring that these trees are going to have the same shape. Oh, this is wrong Okay, this is going to type check. Yeah, that's nice. So Now we can do case splitting once again case put here case put there and lo and behold The other cases they don't show up anymore because it was figured out if this one's a leaf Then this has to be a leaf as well same goes for the branch because They all got the same shape We statically in guaranteed that these shapes Got to be the same So now this this is getting pretty nice So in in Haskell you've got something that's called type inference where you can write a program and Haskell can infer the type we can't do that in the penalty type languages, but we can do something else You can say write this program It was It was said, okay, that's sweet Can it do this this looks pretty tricky? Yes, it can do that. So this is pretty neat Once we've got enough information in the type level I Can sympathize this blew me out of the wall when I saw that first this is So great work Edwin actor is even better at that, but Yeah, so Idris can figure out this by the information that it's got there So can look at that. So it's a lot of information could have written this by hand, but we don't need to That's pretty nice So let's let's prove something this read let's write a function And we call this one is alum and we want to check if an element is in the tree and I'm going to gloss over this detail for a second. So bear with me, please So we've got some element of x of type a we've got a tree t Which has some shape s and it has elements of thing. So what? So what could be the the result type that we want here in? A lot of languages we'd say, okay, this is a boolean But that's a little problematic because a boolean doesn't really convey any information. It's just it's just saying yes or no It's like the answer is 42. What's the question? It's not very helpful so What I want to do now is I want to write a predicate that Contains a lot more information than just the boolean in the case of the boolean. I could just write faults for every case So I could write a wrong function here So let's write a predicate. We call this is alum and It looks like this so Let me look on my chi chi here The branch and The left tree and the right tree. So this is a proof That we found the element so we're not Saying this is we're not just saying okay, we found the element but we are Constructing a path to find this element So this is the proof that we found it. Obviously we need so if we know that Is x is in the left branch Then we can say It's in This tree. What are you doing there? Hating me Oh, yeah, yeah So Say hello to the deck type again So we can't decide this problem You can say for all elements x of type a for some tree we can decide if the element isn't there This is why this is why I introduced the deck type anyway, so obviously we need the right branch Yep, we get to the later. Okay, that can't can't can an element be in a leaf so look at the constructor No, it can't So the branch that's a good You can a branch. Yeah, the leaf doesn't have an element That's what I meant with empty tree. It doesn't have any elements in this case No, it's more here. Yeah, because it's a tree of a In the leaf that but yeah, because it's a tree of a but it doesn't have any elements Yeah It's it's an empty it's an empty tree of type a whatever a is So it's case for here and let's find out What is what we want here? So obviously there cannot be an element in this in this thing because leaf doesn't have any values in there so what I'm going to write now is a function that says not in leaf so yeah, and I'm going to extract the lamma so Let me get rid of this Sometimes it is this very Just wants to add a lot of a lot of arguments. So Okay, let's just do not in leaf Excuse me here and this is just impossible This is this is once again so in this case This this this thing doesn't have any elements therefore it cannot have X in it so This proof says Can't be in there this or Yeah, and the type checks so we can write here Not this is just the same thing. Let's make this a little bit prettier So now we've got to prove that in a leaf there can't be any elements So we got a refutation for that So let's do something else What I'm going to do now is I'm going to do something that's called a with pattern just an intermediate computation and Now I'm going to use this deck eek. So this is a type plus that says for type a we can decide if two things are equal So there are there are some things that cannot we cannot prove to be equal. It's a little bit bothersome But yeah, they exist So we can explain once again Case playing once again and look at that. So This is why and once I'm doing pattern matching here It turns into X so it figured out that these two elements Got to be the same because we've got a proof for that This is dependent pattern matching or non-linear pattern matching So let's once again try to find a proof and here's the proof So writing these things is utterly boring. This is Got this written down Somewhere So yeah, this is oh damn it So I didn't load it bummer Hmm, that's just an address It's nothing interesting really So sources it is 31c3 IDR so this is this is Damn it You're failing me so this is the whole thing and I don't want to write that this is just utterly boring Most of it was rights is for it was rights is for you. So what we got here is we Got a proof that we didn't find the value in the in the leaf We didn't find a value in the left hand's left branch and we didn't find a value in the right branch And this is a proof that it's not four minutes 40 50 minutes. Okay That's So this is a proof that it's not in the tree so That's what I told you it's it's a decidable problem whether that thing is in the tree or not So yeah, that was life-coding and I want to talk a little bit about effects So until now we didn't do any side effects and if you know Haskell there is this bad M word I'm not going to mention here People people tend to get scared every time I say that so We've got something that's called algebraic effects. I don't know if it's on less Gary. I don't think so so This is a very dumb program, but nevertheless it has some interesting things to tell us so up there this is a very horrible-looking type signature, but That's in fact the type signatures so in interest we write type signatures that are bigger than the problem program sometimes That feels kind of weird, but okay, so what this notation says We've got two effects got file IO and we've got standard IO So we can use the file IO effect to work with file system. We can open files read files delete files whatever Um Standard IO is just write something to the console so nothing special here and we can put them into this list So we can have a very expressive types a type signature. This type section tells us what what can go on So in Haskell there is this IO type and it can pretty much do everything So can communicate with the outside world or calculate PI delete your hard drive whatever So in this case, we just know okay, it's file IO It can do some stuff on the file system and it can write to write to the console or read from the console so This type signature has a very interesting If this open has a very interesting types in this function open recognize that if then else on the type level and what it does is actually Figures out is Could we open the file if yes, then we've got an open file handle. Otherwise, we don't have one so This is what we want to use something like if I know it's on the type level So if we look at this effects example once again We are pattern matching on the result Is this a successful operation in this case? Yeah, you can read from So let me try to compile that P effects that Takes a lot of time It's it does a lot of things and The compiler needs to get faster. So it just reads in the first line of Of this program of of the source code. So module main. Yeah So what happens if we do something like that? We're not closing the file try to compile that and I was complaining it says it went wrong basically We are working on something that's called error reflection which makes this stuff readable But if you squint a little bit you might be able to read it Or if you're just using it just for a very long time, but what this actually says it's okay you promised me that This thing would be closed Once you want to leave the program. I didn't do that. So it's still an open file handle So we can track if files are open. It's one of these things that happen quite a lot So you query the database and you just leave that open and you run all file handles and your application crashes and everyone's sad and Yeah, so you can check that we can check that at compile time. We could also do something like that. We just try it Read from an from a closed file So yeah, just just going to spit something else out that you're probably not able to read I'm I Can't do that as well. So Yeah, so This is pretty useful and I want to show you something that is even more useful maybe not too much but so This is a little demo that does typed CSV So we read in CSV and look at the the Schema just the header file in okay. Okay. What what columns do we have and? Read that in and we do that at compile time So once we compile this program it goes out reads in the file picks out the other header and generates a schema and What's interesting about that is? so Yeah, this is Pokemon so So This says okay read in the file read in my CSV Pick out the header generate a schema call this one test schema and whenever we add a new row to this and All we want to query that we've got compile time guarantees that this value is actually in the CSV So we don't have to check is it in there This will always succeed I'm going a little bit over the top with this because I'm also stating the amount of rows that I'm reading in which is A little bit too much to be practical, but it's just yeah for fun So yeah, let me show that to you So let's compile that that takes even longer. Yeah, that took quite some time So, yeah, it's Shiggy. It's German Pokemon. I'm sorry So let me query something else which isn't there Don't fail me address Yeah, and say, okay, this is this is not element of the schema. We couldn't solve that You might recognize this is alum thing which is Over here in This alum So this is this should look familiar somehow and That's pretty neat So this one this line constructs such a proof automatically So we don't want to write there there there here. That's that's a dumb task. So that compiler can do that So this is what this proof search is doing. So whenever we are looking up some field F In some schema, we just try to find the proof that it's in there and Then return a result. So yeah, ten minutes. I think I'm done here. So if you want to ask me questions, please go ahead My mind is still blonde, but if you have questions line up in front of the microphone and ask away Let's grill the speaker Microphone one. Okay. So thank you for your talk. It was interesting Thank you. I have a question. Is it possible to make error look better? I mean to detect some Example type mismatch and write that the file was not closed Yeah, that's possible. So someone's working on on this thing called our reflection and it gives you a type Struct a data structure that represents this error and you can write an interest program that interprets that error message And gives you something that a human can actually read. Oh, cool. So this is one of the things why dependent types are research We don't really know how to handle the stuff It's it's it's very hard to write big applications in interest at the moment. Okay over to Mike to yeah Hey, how is it just implemented? Is it a running in a VM? Is it self-hosted? Oh, it's it's it's not self-hosted at the moment It's it's written in Haskell So if yeah, it's I love Haskell. So it's a great language. So we are planning to rewrite it Maybe at some point But they're not a lot of things in place that we need so we've got this parcel library called light year Which is a pun on parsec from Haskell and This this is what I'm using in this in this In this CSV parvo. So we need stuff like that We need when you look at the at the interest interpreter or the compiler It has a lot of dependencies and we are not nearly there. So Maybe at some point we'll be self-hosted. It's but it's not priority But so what is it so the compiler generates? The compiler generates it generates C and puts it into GCC, okay So or it generates JavaScript or whatever Yeah, like one. Okay. I have two questions actually, okay First one. Do you have any is that are there any projects that you know of that try to apply this? Typing to imperative programming languages as opposed to functional Excuse me. I think I thought are there any Are there any experiments trying to port dependent typing to imperative programming languages? I know of a project that's called flow that Is written by Facebook? It's something that does statically checking on on JavaScript And I've I've seen some of the ideas though. So this branches if then else branches it knows in which Part of the branch it is and I don't know if it really qualifies as being dependently typed I don't think so but there is a There is a project that tries to bring dependent types to JavaScript as well um Scala actually has dependent types. It's it's pretty much the first commercial programming language that offers dependent types Even though not full dependent types like we have an address, but something that is pretty powerful Okay, next question the example of the trees where you have this tree shape type How is that actually implemented? Do you do you have for every tree shape one runtime object? No, no, this construct a new tree you have to this every tree node construct a new You don't need to you don't need these tree shapes at runtime. They can they can get erased So you don't need to store your indices. So you don't have to carry around the length of the vector as well So just are you sure and isn't that isn't that isn't that needed for a paper on that by by Edwin Brady that that's called Oh, how is it called like something like a doctor families don't need to carry their indices or something like that I don't know. No, it's it's something like that. You can't erase them You don't need to sometimes you carry them around when you want to inspect them around time, but you don't need them in general Okay, over to Mike 3 a quick question. Is it as lazy as Haskell? No, it's strict So we've got a strict construct a lazy constructor. You can't have you can put laziness annotations and But it's it's a strict language So this is this is geared toward system programming and Edwin wanted to have something that that is actually strict So you can reason about Space and stuff like that Easier say Mike to Yeah, just a question about these types and proofs that you seem to have I'm intrigued does this do only propagation or fact propagation to get the things that you see there When it you know comes up with a with definitions, etc Or does it do conflicts in other words does it do an NP complete search? And the boards eventually when it you know, it's sort of like oh well, you know I've been researching for half an hour and you know, I'm not gonna come up with this definition anymore Or do you only do propagation of facts like LLDM? You know all the all the current compilers. Let's put it that way So I think that's a question that probably Edwin should answer. I I don't I don't think I don't look at the answer to this I'm sorry Mike one Yeah, so I got two two questions also first one is you showed some first-order logic existential And universal quantifiers. Can you do also second-order logic? So quantifiers and sets or Or is that beyond the scope of the language? Didn't get that as well. Sorry. So can you do second-order logic also or is it just first-order? also motor logic is that in temporal motor logic or That's a good question. I don't know So grilling me to try and also the second second question is So you show this CSV example and it seemed like do you actually need like to have The input CSV available for like compiling. Yeah, so yeah, you have said that you can you can use this in like another nice example would be like Tables for for database so you can call the database get the schema and type there So the CSV is obviously it's just an example It's not really something that is super useful, but I think it's it's a neat example to just demo a little of the stuff So what happens if it's if you feed it with a different CSV? And then you would need to go so you need to compile that once again Yeah, this is so it can't change the program magically just It's it's compile time So you need to actually check the inputs somehow If the schema changes you need to change you to recompile. Yeah Signal Angel, do we have any questions from IRC and stuff? Okay Mike 3 yeah So in that example of the file handles as the implication of that that you could not with the given types Write a program that has too difficult logic governing whether the file handle is in fact closed or Is it that compilation might in fact not terminate? Good question. No, it's not it's not really that so you just you're just the type system just forces you to handle these two To handle these two cases. So you're not actually Compiling and the file handle doesn't get open during compilation. So, you know, that's not what I mean, okay I mean So what if the I mean basically presumably have a certain logic Which is captured by this type system, which it might or might not be decidable and if it's decidable It probably means that you cannot prove things that are particularly complicated about Programs or cannot prove the termination of particularly complicated programs They cannot say cannot type system decidable is what I'm ultimately asking It's a type system decidable. I That's I think that should be Dependent dependent type checking is I don't I think there is a paper that says it's not decidable But I'm very thin ice here. This is so you're asking theoretical questions. I'm just some compiler Want to be hacker just I'm not too deep into the theory. No, this is perfectly fine. This yeah Mike to please If you have a question, please come to a mic so so He's he's got the answer to your question. I think so So we can take this Microphone please so I have no recordings. I Have a question regarding the example for the fight file handling Closing of the high file handlers Where there is a error if the file is not closed. Yeah, and It's possible to generate the closed closed Statement automatically so to satisfy that the file is closed at the end. That's automatic closing. That's yes That's good question. I don't know but if it might be possible Because the same same thing can be applied to the memory management or research resource management in general. I Don't I don't know I haven't tried that could be possible probably Thanks, so it's find out maybe stick on it. Okay last question Mike three and Do you is this language only a proof of concept or do you plan to support it a long time and what are your plans? Implement next so this is once again a question that should be best asked to anyone, but we talked about this quite a lot This is an experiment There are a lot of different approaches to dependent types There are a lot of different kinds of type theory like intentional type theory extensional type theory observational type theory there people try to come up with all sorts of different approaches there and It is pretty Conservative in its approaches. So we just it's just one way. Maybe it risk will turn into a Programming language that can use in production. I don't know 10 years. I don't know Maybe never So this is so currently this is just a fun project to to find out Where where it's where is it? We're going with that and we can go with that Yeah, sure Well, no housekeeping now if you're leaving take anything with you and A round of applause for right you