is presently teaching a course on firearms and violence at Stanford University and has filed in a brief with the appellate court dealing with the banning of assault weapons. I'd like to introduce to you Don Cates. So if I begin to make terrible noises through this thing or you can't hear or something, please wave a hand and I'll try to be, I could probably do better without it. In any event, as a liberal I always enjoy speaking to libertarians since they are, at least on the gun question, since they are the closest heirs traditional liberalism has. Traditional liberalism comes from a philosophy which historians label republicanism, not anything to do with the republican party other than that the republican party has adopted the name. The republicans are a set of philosophers principally associated with the school of Machiavelli and through Machiavelli, Harrington, Locke, and then the founding fathers of our own country. And the republicans were particularly concerned with the right of arms. They followed Aristotle in viewing arms not only as the key to the kind of government that a country would have, but also as a basic hallmark of being a citizen. In the great city states there were two types of people who were not armed and were not expected to come to the aid of the city in times of crisis. Those two types of people were slaves and resident aliens. They were not armed because they were not deemed trustworthy to have arms. But there was also a second element which we tend to ignore by we I should say most discourse about arms in the United States today tends to ignore. From a philosophical point of view the discussion of arms in the United States today takes place or at least when we're talking about a philosophy of government the discussion of arms takes place in conjunction with the idea of power. An armed citizenry will have enough power to overthrow a tyranny. But that ignores a vital element which the founding fathers saw which was that people who were unarmed were deemed not to have the virtue required of Republican citizens. Only citizens who were armed to defend themselves and their property had the moral fiber necessary to be good citizens in a republic. And to the founding fathers the idea that Republican government was in danger the idea was the Republican government was a very perilous enterprise and it depended first and foremost on the moral fiber of its citizenry. The militia concept which is part of that moral fiber and part as well as of a philosophy of power or a philosophy related to power the militia concept was that you had the basic military component of society was the entire armed citizenry composed of individuals who had the moral fiber based upon being armed which also gave them the power to defend themselves and their families and their property from criminals and from the state. And by the same token they had the moral fiber to join with other citizens like themselves in defending all citizens from tyranny whether it be external or internal and also from criminal misconduct which was viewed as a yet another form of lawlessness because to the founding fathers and indeed to everyone 200 years ago the most elemental and basic philosophical right was the right of self-defense and we find that right used again and again in the works of the various Republican philosophers principally or most notably John Locke whose basis for the idea of overthrowing kings the right of the public right of the people to overthrow an unjust ruler a philosophical view he championed and of course was highly controversial in his time for doing so self-defense was the basis of that view the fact was said Locke that God has given man arms with which to defend his property and his life and his family and any tyrant who would take from him his liberty or his property or his life is no different from a robber robbers may be resisted to the death so therefore may rulers be resisted from to the death for they are but robbers when they attempt to tyrannize over the people and when they take that which God has given you you have the right from God whether or not we happen to believe in any God today not a subject I'm about to discourse on but in any event that was his view now at the same time the Republicans particularly Locke were very concerned with another notion we're very concerned with an accusation which they tended to receive and that accusation was that they were an accusation not unknown to us today in a rather different context but the accusation was that that by encouraging the people to have arms and to believe in revolution the Republicans were going to produce anarchy they were going to produce bloodshed there would be at all times a risk of revolution and revolt that would be that that was morally unacceptable and like many arguments from that period I think you can see the relationship to some arguments we have today and the response was the same response in a somewhat different form that we have today Locke's proposition was that if the people be armed there will be no need for revolution because government must always be terrified into recognizing the people's rights and if the people is armed the people are armed government will be terrified and government will not attempt to overthrow the rights of the people whereas if the people are not armed government which is inherently tyrannous will progress further and further and further or regress if you will toward destroying the rights of the people that eventually the unarmed people will rise and then you will have a war of extermination which will produce far more bloodshed than any temporary and indeed Locke would have said quite unlikely revolutionary outburst that might be occasioned from the people being armed because again if the people are armed they need fear they need not fear government now obviously that kind of thinking is far from where we are today when we are told that assault rifles must be banned not because I think anyone has much confidence that that will take assault rifles away from criminals but for a more basic reason which is that people should not have weapons equal to those of government that is I believe the most basic the common sense basis I use the word common sense in quotes for the assault rifle controversy modern liberals I would say pseudo liberals have come to see government as the only proper repository of force Ramsey Clark for instance in arguing that all guns not just assault rifles but all guns should be banned says that it is abhorrent it is unpatriotic to believe that people should defend themselves that is the first duty of government is to defend people and I'm more or less paraphrasing him literally if you see a leap here that is mr. Clark's fault it's not mine and since it is the first duty of government to defend the people they must give up their arms because I guess they must presume that government will defend them even if it isn't doing an adequate job of doing so now in this connection well actually let me also talk about Gary wills whose view is that it is immoral for people to think of for them just to contemplate having arms to defend their families that is morally repugnant presumably what he means is that they should defend depend on government to defend them although he has not fully explained his theory nor why it is I mean his theories expressed basically in a series of epithets you will find it in his columns about gun nuts thinking of how how immoral it is for them to be gun nuts etc and he certainly hasn't explained what seems to me a difficult proposition which is that if it's immoral to contemplate having a gun to defend your family why isn't it immoral to contemplate calling on somebody else with a gun to defend your family one if one takes him seriously then one would have to assume that the American public was most irrationally agitated about the question of Lieutenant Kelly in my lay and the concern that General Westmoreland was not being punished for the atrocities that allegedly he had ordered for in fact it was perfectly all right for General Westmoreland to order Lieutenant Kelly to commit atrocities it would only have been wrong if General Westmoreland had committed the atrocities himself in any event that is the liberal philosophy it is of course not limited to liberals or pseudo liberals today a few years ago in the same month I picked up two articles from the New York Times both of which had amazingly similar well I don't know that they're amazingly similar maybe only the libertarians would they seem similar and the New York Times simply quoted them very approvingly without any suggestion of the what seems to me and I'm sure will seem to libertarians the difficulty in them the first was a comment by a deputy director of the FBI that citizens should not have handguns only the police should have handguns because the only purpose of a handgun is to kill now think about that only the police should have handguns because the only purpose is to kill the other comment was from a New York City police officer who said that citizens should not have handguns because they would always lose in a contra confrontation with a criminal because criminals were ruthless brutal sociopaths who would shoot first and ask questions later only the police should have guns don't issue laughing I assure you the New York Times printed those and I don't think that either of those statements they printed they printed them perfectly straight and the National Coalition to ban handguns has distributed those statements and I take it that neither the New York Times nor the National Coalition to ban handguns had any thought at all like he's going through your mind and that is a rather frightening thing right there now one of the other phenomena which I associate with the pseudo liberal or which which comes from this phenomenon of which I've been speaking is that because they are so fundamentally unsettled by the notion of citizens using force to defend themselves that view which is a philosophical view or I let's put this way to be to put it charitably it's a philosophical view but certainly not a pragmatic view that view however gives rise to a pragmatic errors the same people who say that it's wrong for citizens to defend themselves also say that it doesn't work now for we are fortunate that anti-gun organizations are so infused with this view because over the past 10 years they have sponsored a series of investigations to determine to show that people can't defend themselves with guns and that people don't those investigations consist of polls which they've taken to determine because I feel that there's no other information really elicited about the extent to which people defend themselves we have extensive information about how people use guns to commit crimes but how criminals do that but not any information of how we have citizens of how many citizens defend themselves against crime while these polls taken at the behest of various anti-gun groups have remedied that information deficit and professor cleck who is the single most important social scientist working in this area today published an article last year which dealt with the information from those polls and based on those polls he has determined number one that good citizens with guns use them more frequently to defeat crime than criminals use guns to commit crime handguns are used approximately 645,000 times a year by good citizens to defeat crime while they are only used by criminals committing crime approximately 580,000 times a year now the second question that he inquired into was the issue of injury here he used a different sample instantly on the verifying the fact of the use of handguns to prevent crime a recent federal survey of 2000 prisoners in state prisons across the united states found that they were more afraid of good citizens with handguns than they were afraid of the police that they had been substantially deterred from committing crimes because of the fear that victims might be armed and that they that that approximately 30 percent of them had been captured or scared off by citizens with guns in one or another crime and that 65 percent of them knew other criminals who had had the same concern and that the thing they were most worried about more worried about than meeting the police was meeting a citizen armed with a gun but let's talk about the danger of injury uh pete shields the head of handgun control ink advises you to submit to rapists or robbers rather than resisting because of the danger of injury give them what they want he says or run away if you can now professor cleck finds that pete shields is correct as long as you're going to resist without a gun if you're going to resist without a gun your chance of being injured is approximately 48 percent uh that's using a knife or a club or or your bare hands if you're going to if you're not going to resist if you take mr. shields advice your chance of being injured is 25 percent because criminals often injure their victims regardless of whether they resist if you resist with a gun your chance of being injured is 11 percent now that's a rather impressive uh statistic and well worth thinking about but as i say to liberals and not only liberals such resistance is immoral or wrong at least because they value orderliness above all and it's disorderly to having have citizens resist the police you can rely on interesting since they don't have much respect for the police in any other context but you know the only people who should have guns are the police and you can rely on the police but everything else is disorderly my girlfriend recently saw a tv program in which uh they were showing school children now being trained to deal with the assault rifle uh problem at a signal from the principal's office the teacher will signal the children and the children will all get under their desks and my girlfriend's question was this if somebody walks into a classroom with an assault rifle it'll be real orderly all he has to do is shoot all the children who will be sitting under their desks unable to escape rather than the disorderly thing of having children run in all directions which makes it much harder to shoot them but it is so much more disorderly i mean after all what are we concerned with in this society merely saving lives or having an orderly society in which the best and the brightest provide moral instruction and welfare to a passive population of what we might reasonably call the masses uh who are able to benefit from this moral instruction by these higher sets of people such as pete shields and ramsey clark and gary wilson it is because they have this profound conviction that the individual force use of force is wrong that pseudo liberals have come up with such preposterously non empirical pragmatic arguments for instance we all know that it's absurd to talk about an armed populace defeating a military force i mean after all think of all these stupid people with their stupid handgun shooting running out and shooting at tanks and then throwing themselves with their handguns right under a tank rolling over yes if you assume that everybody is stupid that certainly is a really stupid proposition but if instead you assume that ordinary americans have as much intelligence as jews in israel and the irish in ireland and the angolans in angola and the iranians in iran and the cubans in cuba and i can keep on listing for about 15 minutes all the peoples in the 20th century who have had revolutions and not just fought modern military powers to a standstill but totally destroyed and overthrown them it is virtually impossible to name a guerrilla war in the 20th century that a modern military power won and the only thing which we have when liberals talk about how useless and absurd the right to keep and bear arms is compared to the power of a modern military well they'll talk about world war two and tanks well what the that's got to do with anything the american people are not about to declare war on government what we're dealing with here is a question of guerrilla warfare and guerrilla warfare virtually always wins among other reasons it virtually always wins is because the army is part of the people too and sooner or later the army decides it's sick of having this kind of a fight and goes over to the people or substantial portions of the army does that but of course to the to the pseudo liberals the idea of the army doing something so disorderly uh is something else it's anathema all right i i i'm tossed out a bunch of ideas and i may well have some questions and i've talked for a good deal of time and since i don't since i was too disorderly to bring a watch this morning i don't know how long i've talked so those of you interested will be taking a 30 minute break


At this point I'm pleased to introduce our next speaker Gretchen Daly, the founder and faculty director of the Natural Capital Project and the Bing Professor of Environmental Science at Stanford University. The title of her talk is Accounting for Natural Capital from Demonstration to Transformation. Well I want to say first off I'm really grateful to have been invited. This has been a tremendous workshop and I've learned a ton and really appreciated the many realms of expertise that people have been putting forth to sort of stimulate this conversation about what we can do in the realm of natural climate solutions and in harmony with the much bigger picture instead of goals we're trying to achieve some of the toughest goals humanity has ever pursued. So I love the quote you ended with Joe from Martin Luther King on good science being compassionate science and in that spirit I'd love to dive in. I'll try to connect a bit with the presentations made over the past couple of days and just lay out the arena that was put forth to me namely how do we account for natural capital how do we value nature essentially in decision making and how can we move especially what I'd like to address a bit here is from demonstration at relatively small scales so the scales are certainly increasing impressively but whether it's fast enough it's a big question so how do we move from demonstration to real system-wide transformation in harmonizing people and nature. So I'd like to just hit on the key frontiers and basically my take-homes that are number one there's been this massive science advances over the past decade or two in this arena especially in the past 10 years new science new data allowing us to run calculations that were undreamed of before and looking at sort of a return on investment in nature's benefits to people and in economic security and recovery with really targeted approaches so we need to enhance use of this data and science to better target our investments in scaling there is a lot of deep experience on which we can build much of which remains still kind of little known and poorly shared between countries and regions and the institutions implementing it so another arena in which we could accelerate is in scaling success and third and excuse me finally I'd like to emphasize the tremendous need to come up with new metrics that let us track performance whether it's of policies or the entities meant to implement and evaluate them there are also some really promising advances being made here that we urgently need to integrate much more widely into for example the climate conversations we're having today so the overarching questions when we think about you know achieving climate security especially through natural climate solutions in the context of all the pressures on land and on kind of the earth system broadly three that really come to the floor are you know how much and where should we be protecting ecosystems and in what ways second how can we harmonize people in nature and specifically how can we secure nature through conservation and restoration and at the same time secure human livelihoods then third how can we move beyond GDP as the dominant metric that is so fundamental in many key realms of decision making so just to tie in a little bit to the past couple of days a couple of presenters and then Sarah you nicely summed up this morning sort of noting the tremendous potential for natural climate solutions shown here to help drive the reduction in emissions and actually you know reverse all that in the near term but also the many constraints that we face and the worries over massive shifts in land use that might trigger other dramatic problems economic social political as well as just the biophysical challenges of providing enough food to energy access and other fundamental sort of human needs so if we look further at this paper the nice analysis by griscombe and others this also was shown in the past couple days there are these sort of climate mitigation pathways involving different ecosystem types on the left forest ag lands pasture lands grasslands broadly wetlands and the analysis focused on their climate mitigation potential and then there's this little box down at the bottom and these little tiny bars on the left of the vertical axis showing what the other benefits might be and what I'd now like to dive into with those questions we have in mind like of starting with you know where and how much to protect let's look at those other sort of co-benefits that would come along with these strategies how do we estimate you know how much to protect in the way of for example let's just get into land you know where do we draw the line between let's say agricultural lands and tropical forest lands how much in any different you know region or country would we need to protect in what in some sense would be optimal under different let's use Martin Luther King's criterion you know a compassionate at the same time realistic equitable kind of approach what about with biodiversity you know which elements of biodiversity are likely to survive a human impact how can we foster those that are most important to human well-being and hopefully also in some broader ethical dimensions whether it's bees for pollination the vast majority of our you know nutrition really comes from the fruits nuts veggies and other pollinated crops that we grow there's tremendous benefits provided by birds like this pair of royal flycatchers that conduct natural pest control then there's things that we've just got to be a lot more aware of here's a big pest control agents in the middle this fabulous largest bat that's carnivorous in the new world spectral bat yet so it goes around eating those flycatchers also a lot of insects and things but we know that many of our serious diseases come from bats and biodiversity isn't 100 of positive things we've got to be much more aware and sophisticated when it comes to our analyses and plans for manipulating biodiversity and understanding where we really need to protect to minimize the kind of disruption that we're facing now with the global pandemic and finally just touching on water here looking at a wonderful expanse of the Amazon up into the highlands in Ecuador we know that forest plays a crucial role in many dimensions of water supply whether it's storage and flows for drinking irrigation and hydropower or flood control protection of downstream communities and property or famously for the Amazon but also for many other forest systems a powerful influence on atmospheric circulation of water and on precipitate sorry precipitation patterns in many regions that could be severely disrupted with widespread further deforestation so how do we think about all of this in an integrated way what we really want to know here taking kind of an economic production function approach teeing up Larry Goulder in a minute maybe is you know what kind of implications would come from alternative changes in management or policy on the left such as a decision to restore habitat and maybe reduce some of the cropland area changing ecosystem structure protecting stream side habitat to improve this ecosystem function of water filtration and retention to improve let's say in a region like California or in much of Asia where you have precipitation just in certain parts of the year water retention and meeting it out for irrigation hydropower and drinking year-round and improving water quality leading to many benefits including and now I can't quite see what's on my far right but reduced treatment costs and other benefits to people so what we want to be able to do is conduct this kind of analysis in a lot of different arenas these arenas are shown here you know everything with climate security up there very prominently as an overarching arena encompassing coastal climate protection urban cooling food production flood control just water and energy production broadly and then various aspects of health many other types and sort of classes of benefits that we want to be able to analyze in an integrated way to know how much and where to protect and how to harmonize across all of these in some ways competing objectives for the land and other resources across earth's surface so there's been a large community that's developed models in each of these areas some for you know in traditions going back decades in some arenas especially in water modeling and other parts of the system food and agricultural modeling other areas such as mental health especially very new or some elements of say modeling food production and agricultural systems like in pollination services from nature pest control services being very new all of these are being integrated through the natural capital project into a sort of modeling a data and modeling software platform for integrated valuation of ecosystem or environmental services and trade-offs and this is being widely used mostly well in a number of realms across most countries still I'd say a long way to go to mainstream this kind of approach but I'll show you some of the most powerful examples actually driving this into planning and practice today so the idea is to take all the data that are streaming in through different sensing technologies take these questions and the new understanding we have in science of the values of nature embedded for example here within agricultural systems and using the software to inform decisions and drive real impact in changing land management and the financing thereof to make it all basically possible to harmonize kind of people and nature so here's an example run for IPFS the IPCC for biodiversity and ecosystem services but it's just recently been set up and delivered its first assessment report in 2019 and what I want to emphasize here it's a lot of maps but the point is if you look across the top there's three services of about 18 that were modeled that really operate on a very fine scale and now for the first time thanks to these advances in the technology and the data streams coming in and the modeling by many many groups worldwide in many of these arenas we can model at a very fine scale things such as water quality regulation, coastal risk reduction by mangroves, seagrass, beds, coral reefs and such and crop pollination by you know little bees and other types of insects primarily so it's quite a major improvement in our ability to project you know what the benefits are being provided across the world under current conditions what populations are most vulnerable or exposed and have the greatest need for nature's contributions so that you can see where people's greatest needs line up with nature's greatest potential contributions and make forecasts aligned with the IPCC's type of forecast for the future I won't get into that further now but what I'd like to do is kind of just emphasize that we can do this at very fine scales anywhere in the world now even in quite data poor regions there are enough data to link the human and some aspects of the economic and social dimensions of a place with the provision of these benefits of nature and project the implications of alternative decisions or development plan so I'm going to show you a couple of examples now and we'll emphasize Latin America and China so there I'd say thousands of examples now worldwide those shown here really demonstrate at scale an impressive scale how to integrate this understanding into investments and so Costa Rica really kicked it all off it's a famous case probably most of you are familiar with it so I'll start there just going back to 1997 with just some really brilliant innovative leaders of the country at the time including Alvaro Mania and setting up the first national payment system worldwide for the provision of these benefits or ecosystem services and paying people through a variety of financial payment streams some international from European investments in a trial period back then others domestic and a lot of this is really run through a fuel tax on petroleum in the country even as they're trying to decarbonize so they're trying to figure out where else they'll get the revenue or the draw the investment from but paying people to secure climate purify water provide a range of biodiversity benefits in farmland and secure scenic beauty for tourism all of these kind of major parts of the economy and this is one component of the dramatic turnaround that Costa Rica made from having the highest deforestation rate in the world to today a net reforestation so let's touch briefly on the Caribbean in particular where I know we're not focusing so much on climate adaptation but where you know that's the name of the game these days sadly and where there's been dramatic shift in mindset and in planning using these types of tools to look at the coastal climate protection that could come from restoring habitats or at least protecting existing habitat and being mindful of those habitats that protect people and property from storms when developing country or regional development plans that integrate across you know many sectors transportation other infrastructure to urban systems tourism mining forestry the whole bit all of this is being quite integrated I'm showing a a tiny example in geographic terms but one that's been very influential given all of the tragic damage that's been sustained in the Bahamas and particularly on this island Andros Island and that's now really informing together with similar work in other countries in the Caribbean and Latin America more broadly an investment by the Inter-American Development Bank in this approach across 26 countries just integrate this science and understanding into development planning and fund development plans that are climate resilient and finally I'm going to turn too briefly to China that I'm going to show very rapidly just a dramatic transformation in policy and in the science and capacity needed to implement these policies toward a green financial system this comes after you know many decades of very impressive GDP growth that listed about 850 million people out of poverty that came at a tremendous cost environmentally so recently the government has added the ecological dimension of the nation as a major pillar amongst five pillars in total of national development and supporting this the country has developed by far and away in the most sophisticated assessment of its ecosystems and I'll just show a few slides that show the incredible detail by with which they're able now to analyze the stocks of natural capital that provide these benefits and the flow of services from these different ecosystem types to people here the services are shown and it was found that over the past the years from 2000 to 2010 that there was actually an improvement in all of these services thanks to the major investments that started being made in environmental protection in China around the turn of the century following devastating flooding that was traced to deforestation the one area where there's been a continuing decline is biodiversity conservation so the country has responded to all of this by zoning land and declaring sort of priority benefits or stocks of natural capital like biodiversity for restoration and is targeting payments to 200 million people today to conserve and restore ecosystems across the country there's a lot of detail we could get into here it sort of looks like this in any given place every square meter of basically the entire country has now been zoned from both a kind of top-down approach with the central government declaring national priorities that do include carbon sequestration by the way but they focus more directly on the locally and regionally delivered and consumed services and also through a bottom-up process they're setting out a whole new massive national park system and in paying people really looking at the social dimensions of the elderly populations that are left in many rural areas and in urban areas really getting to Rob Jackson said something the other day about just inspiring people and raising awareness and trying to drive public support for these major investments across the cities at today starting with these priority cities and then just to close I'll end saying that China is really moving past GDP it looks like it's all yet to be seen but they've pioneered a way of developing a parallel system of accounts for ecosystems to quantify and track change through time in gross ecosystem product that looks at the value of all the goods and services supplied across the country and at many scales in a year so drawing in data from all those different sources across the country running them keeping tabs on the actual stocks of natural capital but looking at the flows of services through this modeling and then in red you know revealing the contribution of ecosystems to the economy and society broadly informing these major financial compensation programs that are underway that involve paying so a city will pay upwind and upstream and other things regions that supply services whether it's you know air and water quality or food and just water supply or soil conservation and other things and then finally evaluating the performance of policies leaders and investments so I'll close here just bringing us back to these opportunities to scale and emphasizing that there's a lot of traction through the major multilateral development banks and big question is how else to partner at a higher system-wide scale now to drive standardization of some of these approaches and really you know aiming to mainstream much more powerfully than has been achieved to date thank you. Thank you Gretchen we've got the questions piling up so I'm going to hand it over to Jenny. Thank you Sarah and thank you Gretchen it was a lovely presentation we'd like to go to Jessica Hinojosa sorry for the mispronunciation there but Jessica when you're ready please unmute yourself and ask your question. Sure great thank you and thanks Gretchen for for a really really fascinating presentation. My question is kind of around government buy-in and you know with with getting governments to kind of agree on the value of natural capital and be willing to invest in it you know I've seen things before that say that sometimes actually autocratic leaders or leaders in countries where there's long longer election cycles might be more willing to adopt some of these practices because they can actually see the decadal scale change or their return on investment I'm just curious on your perspective on that and especially you know being US based you know do shorter election cycles make it harder for government officials to be willing to invest in natural capital? I think you've put your finger on something important but I'd also say there there's so many other factors that it's hard to it for me to see very insightfully into where the greatest potential is for driving the political shifts that we need so what that's where working with the development banks has actually been very powerful because they come in with a public facing mission they're tightly they have very good access to finance ministers prime ministers and others and they bring money with them and so many of these development banks have been pioneering relatively small to medium scale demonstrations very successfully and then I think the the public's kind of learning about it as this happens and it's all really over the past very few years you know three to four years so in a way this change is happening at light speed relative to the normal rate of cultural evolution but how to bring it here how to bring it here is a crucial question and I'd say we've had quite a bit of traction at the state level but since the past over the past four years obviously no real traction at the national level in the US but thanks for that insight I'm sure you've got your finger on something important there lovely thank you and if we have time for one more question I'd like to go to Shafiq Jeffery Shafiq hi Gretchen thank you for the presentation I was curious how can we kind of validate some of these models because it's quite complex coupling across them and to be sure that we're actually taking the right actions how do you foresee that I mean obviously this is still very early stages so yeah you're raising a very good question there's been like I referenced really briefly a tremendous amount of work in some areas and then going back to Rob Jackson and Chris Field they both referenced a lot of work on the interactions of carbon and water in forest systems in particular and what you're trading off under different scenarios so there's some arenas where long predating this effort to integrate at all we have some good understanding of the interactions and such but there are other areas where like you say we are just at the beginning of a really advancing the science and approach and basically it's just going to take more time with a high emphasis on the worries that I think you're pointing to that you know we might get it wrong and that's certainly the question you raise is a really important and central one but I I think beyond focusing on it working harder and trying to implement some of this and track progress that's probably the best we can do thank you


On January 26, 2019, India celebrates its 71st Republic Day. For this historic day, the far-right wing government of Narendra Modi has invited Brazilian President Jair Bolsonaro as a guest of honor. It's a match made in right-wing heaven, two leaders with the record of dividing their people, attacking the left and progressive sections, and submitting to U.S. interests. The Indian left is on the streets against this visit. In this episode of Around the World in 8 Minutes, we take a look at these protests and strikes in Colombia and South Africa. During his presidential campaign, and after being elected, Jair Bolsonaro has made a name for himself through his racism, bigotry, and anti-people policies. The Indian government of Narendra Modi, meanwhile, has just passed a citizenship bill that will turn Muslims into second-class Indians. In today's protests, members of farmers, women's and student organizations condemned his right-wing alliance and the politics of both these leaders. Here is some footage from the protests. Bolsonaro, go back! Go back! Go back! Bolsonaro, go back! Go back! Go back! Go back! The All India Democratic Women's Association, along with all the other organizations like Kisan Sabha, SFI, D.Y.F.I, and the Adivasi Adhika Rashtriya Manj, we organize a protest today against the Brazilian President Jair Bolsonaro, who has been invited by our Prime Minister for the Republic Day celebration. We think it's an insult to the nation because Bolsonaro has been taking anti-people's policies in his own country. He has been insulting women. He has been passing extremely atrocious statements against women. In fact, it's like justifying rape. He has been insulting the LGBTQ people for whose rights. In India, we have been fighting continuously. He has been harming the indigenous people in Brazil. And in India, we have seen we've been fighting for the rights of the tribals, rights to land, rights to the forest, which exactly the opposite Bolsonaro is doing in Brazil. So we think calling Bolsonaro here for the Republic Day celebrations is an insult to the people of India because as the people of India are resisting the neoliberal policies and India itself, similarly the people of Brazil are fighting for their rights. And Narendra Modi has become a symbol of trying to protect all kinds of people who are authoritarian. He is allying with authoritarian people all around the world, people who are crushing the resistance within their own countries. And that is why AIDWA feels that at a time when there is violence, has increased so highly in our country to invite a president who justifies rape, who abuses women, who is insulting to women, just shows the character of the BJP RSS. It exposes Narendra Modi. And that is why we have opposed, we have protested, and we have said that we are not going to allow Bolsonaro's visit in India to go unchallenged by the people of the country. We are demanding that fix the price on the basis of Dr. Swaminathan Commission's recommendations, cost plus 50%. The government of Asia, India is not giving. According to that, minimum rupees 500 per quintal, that is 5000 per ton, should be the price of sugar cane. They have fixed for this season 275 per quintal, 275 only. One. Second, already 24,000 crores, over 24,000 crores are lying with the sugar mills as areas of sugar cane farm till today. You know the sugar cane farm, the government is doing nothing. Sugar cane, if you farm the sugar cane, the field is engaged for 2-3 years. It is not like paddy and wheat that you take one crop in 3-4 months and you put other crop. The whole 2 years you can do nothing. Only after 2 years you can finish that and go. So the farmers are engaged and if you don't pay the proper price, how they will lead, what they will lead, what they will do for the education of their children, for the medicine and for other family cost and then the capital for the next crop.  Actually to capture the such an Indian market, because Brazil has a very good production of sugar, they want the market. So they are eyeing on Indian market. And why this man has been invited by our Prime Minister, we don't understand. We now go to Colombia, where massive mobilizations took place on January 21st, marking two months since the beginning of the popular uprising against President Ivan Dukie. The rise in assassinations of social leaders, the scandal involving the army carrying out illegal wiretapping and the neoliberal economic measures passed by the Colombian government were some of the factors that brought the people to the streets. Students with artistic interventions, music, blockades of public transportation and major roads and potent pan banging were carried out in Colombia's major cities. The response of the police was repressive as usual, with students and youth being attacked in the southern part of Bogota. The strike was called for by the National Strike Committee, which is made up of diverse social movements. The National Strike Committee had originally drafted a 13-point list of demands that was presented to the government, but after deliberations and discussions within the committee, the list has grown. The key demands include the withdrawal of anti-people economic policies, including the tax reform passed in December, the immediate dissolution of the Mobile Anti-Disturbance Squadron Esmart and effective measures to halt the genocide of social leaders, human rights defenders and ex-combatants. The protestors are seeking a commitment by the government to implement the peace agreement signed with the Revolutionary Armed Forces, FARC in 2016, and the reinitiation of peace talks with the National Liberation Army or the ELN. 15 seconds of far-right government of Ivanduke are expected to continue, and social organizations are undertaking new ways of channelizing the outpouring of energy that has been seen in the past two months. And finally, nearly 3,000 workers from 15 security companies in South Africa are in an indefinite strike since January 21st. They are demanding the payment of wages that are due from December. The workers are employed by companies contracted by the Department of Community, Safety, Security and Liaison of the Pumalanga province government. They provide security for clinics, hospitals, South African Social Security Agency offices and licensing departments. The protesting workers are members of the South African Transport and Allied Workers Union, SATWU. The union is affiliated to the KOSATU, which is an ally of the ruling African National Congress. Security guards earn anywhere between US$300 to 385 a month in a country where the living wage for a single order is estimated to be around US$418. Security guards have claimed that they are not in a position to pay the guards because of the provincial government, which has not paid their charges since December. The government department has cited financial constraints and said that the salaries for December, January and February will only be paid in April 2020. In South Africa, which has a high crime rate, security guards play a crucial role in ensuring the safety of people and property. Their number is twice that of the combined strength of the police and armed forces. The security guards are determined to continue their struggle till their due wages are paid. That's all we have for this episode of Around the World in 8 Minutes. To know more about these stories, visit our website peoplesdispatch.org and follow us on Facebook, Twitter and Instagram. Thanks for watching.


Today, I'm going to be creating a GTK application using Haskell. I had an idea earlier this afternoon of a very simple application that I could build. Start to finish on camera on this one video and guide you step by step on exactly what to do. And this is going to be a very simple application that you can follow along with me and you can build it with me. And you actually don't even need to know any Haskell for the particular application I'm going to build today. It's going to be rather simple, so you don't really need to know Haskell. You're not going to need to know about, you know, creating recursive functions. You're not going to need to know what a monad is or anything deep like that. You know, today we're just going to keep it very basic, very simple. But after today, I think you'll have a better understanding of what GTK is, how GTK works and some of the Haskell bindings for GTK. One thing to note is that on a previous video about Haskell and GTK that I did, I used UI.GTK, that particular set of libraries, that particular set of bindings for GTK. But there's a more modern Haskell GTK library out there called GI.GTK. The particular package, if it's in your repositories and your Linux distros repositories will typically be Haskell-GI. For those of you on Arch Linux or Arch-based Linux distros like I am, you can't actually install Haskell-GI from the Arch repositories because it's packaged in the AUR and the AUR package for Haskell-GI will not compile correctly. I've tried it. I've tried it for many weeks, many months that package has been broken, which is really the reason on my previous video I used a different set of GTK bindings, a different library. But Haskell-GI is really the one that most of the Haskell community recommends that you use. So what we're going to do today is we're going to install Stack. Stack is kind of like a Haskell package manager. It's really not a package manager, but it's a way of managing applications that you're working on. You can think of Stack. What it does is within a project within Stack you can specify in a config file all the various libraries that are dependencies for the program you're working on. And Stack will pull down those libraries, it will install them for you, it pulls them down from a Haskell repository of software called Stackage. And then you don't really have to worry about your Linux distributions repositories and whether it has some of these Haskell libraries or not or whether they compile correctly or not because Stack will just take care of all of this for us and it's just a really nice way to work. So the very first thing you need to do, of course, is make sure you have Stack installed on your system. And there are various ways to install Stack, but the recommended way is to go to Haskellstack.org and on this website, how to install Stack, there is a curl command. So just run that command in a terminal and it will install Stack for you. And of course, you can read some of the documentation on exactly how to use Stack, but I'm going to talk you through it. So before we're getting started, I should tell you the program we're going to build today. So I've been thinking, what is the simplest program I could use for an example, especially a very first GTK application, and I have this logout program installed on my system called OB logout or open box logout, right? It's typically used for open box, but it can be used for other standalone window managers. It's a very simple little application. This little window with these seven buttons here, and you can see Cancel just closes the application, but you then have buttons for logout, restart, shutdown, suspend, hibernate, and lock. You can think of it as kind of like a session manager. And this is rather easy. When I launched this earlier today and I took a look at it, I was like, you know what? I could recreate that using Haskell and GTK probably in like 30 minutes. And you know, I actually did this earlier this afternoon just to see if that was the case. And yeah, it took me about an hour to recreate this in Haskell. And you know, most of that time was really spent creating some images. So what we're going to do is we are going to exactly recreate OB logout or close enough using Haskell dash GI. So let me quit out of OB logout and let's open a terminal. So to get started, if you already have stack installed, the first thing we want to do is we want to set up a new project. Now I'm going to CD into this directory here called source in this source directory. This is where I have various Haskell projects that I work on. And the very first thing you want to do is you want to run stack new and then the name of the program. I'm going to name my logout program bye bye, because essentially when you're logging out or shutting down, you're telling the computer bye bye, right? Let's go ahead and create that. Now when you run stack new name of project, you may get some errors because we should have set up a stack config file. You can see, you can see that in your home directory, you have a hidden directory called dot stack. And in that directory, you have config dot YAML. That's your stack config file. And in that config file, you have various variables that you should set. For example, your name, your email, the category of your software, copyright, your GitHub username. I don't actually have a GitHub username. So some of the stuff I can't set. But whatever you don't have set, it's going to complain, hey, we couldn't set these values. And because it's going to write these values and some other config files that it's going to generate, but it's no big deal. Even if these aren't set, the stack new name of project command, it's still set up your new project. It's just letting you know that it couldn't set these particular parameters. Now that we've created our new project, let's cd into the new project. So I'm going to cd into this new directory that was created called bye-bye. Because that was what stack created for us when we did the new project. By doing ls, you will see there are three directories and then several files that were created. The three directories are app, source and test. And then you have various files. So you have a change law. You have the license. You have package.yaml, which is very important. We're going to play with that. If I open this, I can open this really quickly here in Vim. You will see what this is. This is what really makes this interesting is you can specify dependencies. Right now the only dependency is base, just the Haskell base libraries. But we're going to need some other stuff here as well. As a matter of fact, I could go ahead and add a few things I know we're going to need. So I'm going to go ahead and I'm going to add these three packages right here. We're going to add gi-gtk. I'm going to add gi-gtk-hs and Haskell-gi-base. So those are a lot of the GTK libraries, the binding libraries that we're going to need, of course, to create our GTK application. We're probably going to have to come back to this file and add some other stuff later. But let's go ahead and write and quit that right now. And if we wanted to actually run this application, this new application that we created using stack, it's already a fully functional application.  Stack setup is probably going to take you a while if this is the very first stack project you created because it's going to install GHC, the Haskell compiler. And that installation is going to take some time. Now because I work with Haskell a lot, I've already got GHC installed. I've used stack before, so I didn't have to go through that. Two other commands you need to be familiar with are stack build, which just compiles your application, assuming it compiles correctly. And in this case, the application compiles correctly. It tells us that it created an executable for this application. In this case, it's the name of project-exe. So in my case, bye-bye-exe. Now if you wanted to run this, you don't actually have to go find the location of that particular binary. You can just do stack run from inside the project. And it will run the bye-bye-exe, which all it does by default is it prints out to standard output sumfunk. Because that's the standard template is there's a library that prints out the word sumfunk and our main.hs, all it does is prints that. So let me open up Emacs because I'm going to use Emacs for this and I'm going to navigate to my source directory slash bye-bye. I'm going to hit enter. Let me zoom in. And of course, this is the directory structure I mentioned. We have app, source, test. We're not going to do anything with test. And really, we're not going to do anything with source. Source is where any kind of functions and libraries you create yourself that will be called from within the main, you would put these here. And there's already a file here lib.hs. If I hit enter and zoom in, you can see all it does is prints to standard output the word sumfunk. Now let me go up a directory. I'm going to go into the app directory and main.hs. And what does main.hs have by default? It just runs sumfunk, right? That particular function that was defined in lib.hs. Now I actually won't be using that lib.hs file for anything. So let's just get rid of that particular import. We won't need it. And obviously I'm not going to want the main block to equal sumfunk because we're no longer calling upon that particular function. So we're going to do something different for main. We are going to do main equals do hit enter. And we're going to do gtk.init space nothing. So this initializes this gtk application that we're creating. And then we're going to write a whole bunch of stuff. We're going to create a whole bunch of widgets. And then at the very end, we want to do gtk.main, which starts the main loop. So that is essentially what a gtk application written in Haskell should look like. You have gtk.init. And then at the very end, gtk.main, which starts the main loop, and of course everything in the main loop, is going to be all the widgets that we're going to define. Now the first thing we want to do is we need to import some libraries. We know we're going to need the Haskell GI gtk libraries. So I'm going to import those as qualified. You often have to import certain libraries in Haskell as qualified because there's so many Haskell libraries out there that people have created. And some of those libraries have function names that are the exact same name as a function in another library that you might import. So it's very important in all the tutorials for gi.gtk, they are almost always imported as qualified. And they typically qualify it as gtk. Now what this means is every time I use a function that is part of gi.gtk, I need to pre-pin that function with gtk. For example, init, that particular function there is part of gi.gtk, but I need to specify gtk.init because I imported it as qualified. I hope that makes sense. So how do you get all of the various functions and widgets and everything that are part of gi.gtk? Well, here's how I do it. Because I'm used to viewing Haskell documentation. I just do a quick Google search. I type Haskell gi.gtk and then name of whatever it is I'm looking for. In this case, I typed Haskell gi.gtk button. The very first result is this particular library here, gi.gtk.objects.button. This is how you create buttons using the Haskell gi.gtk library. And it gives us the various functions that are part of this library. It tells you the parameters that each function takes and what the result of that is, what it returns. And this is essentially the same as for anything else that you look up as far as Haskell documentation. You get a page just like this hosted over on hackage.haskell.org. And honestly, I find the Haskell documentation very easy to wrap my head around because it's laid out in a very user-friendly way. Now, I'm not going to spend a lot of time digging through Hackage here on video. I'm going to let you do that now that you know the site. Just do a quick Google search. Just search for Haskell gi.gtk. And then name of whatever function or widget or whatever it is you're looking up. And I promise you Google is going to take you to the proper page. Now, let me get back into our file here. The first thing we need to do before doing anything else is actually creating a window because right now this GTK application does nothing because we haven't defined any kind of widgets at all. And of course, the top-level widget needs to be the window itself. I'm going to name the window simply win. You can name it whatever. You can give it any kind of name, but this will be the only window for this application. So I'm going to keep it short and sweet. So win and then I'm going to do a left-pointing arrow, right? So that's a less than sign dash. And we're going to do this GTK.window new and new is capital N. So Haskell functions always begin with lowercase letters. And this is very important when you start creating your own functions. Never create a Haskell function with a capital letter. It won't work. The Haskell compiler will complain. But if you have a function name that is two or three words combined, such as my new function, you would do lowercase my, y. And then on each word, you would capitalize the first letter of each word, very similar to what was done here with this window new function. And then this particular function here, it takes an argument. We need to tell it what kind of window we're creating. And again, you can look this up in the documentation, but I'm just going to tell you what I'm going to do. I'm going to do GTK.capital window type top level. Let me make this full screen so you can see that. Some other things I'm going to do. I'm going to do a GTK set container border width. And we're going to set the container border width for widget win. You have to specify the widget that we're setting this for. And then I'm going to do a border width of 10. So our window should have a padding of 10 around it, right? So things aren't butted up against the edge of the window. Then I'm going to do GTK.set window title. I put a space here by accident. So GTK.set window title. And what widget are we setting a window title for? Well, we're setting that for win. So the same pattern, right? It's very easy. You quickly get the pattern of these things. And then this is going to take a string. A string in Haskell needs to be wrapped in double quotes. And I'm going to set the window title as buy, buy the name of our application. For sake of time here, I'm just going to paste a few more window settings here. I think these are pretty self-explanatory. I'm going to set window resizable to false, meaning I don't want the window really to resize. And then when I set window default width and window default height, I'm going to make it 750 by 225. And then I'm going to set the window position to GTK.window position center. I want it centered in the middle of the screen the way, you know, OB logout, right? And I'm basically trying to get this to be like OB logout. Well, now I'm in a tiling window manager and a floating window manager. It would actually appear, you know, centered and be somewhere around this size. And that's what I'm trying to recreate here. And finally GTK.window set decorated. We're going to set that to false. We don't want window decorations, not for something like this. Window decorations would be having a title bar and a close button and a minimize button and all of that. Now that's great for normal application windows, but for things like dialogue boxes, toolboxes, and in this case, this logout box, we don't need window decorations. That's just a useless cruft added to the window that doesn't need to be there. So now that I've created a window, we could actually try to launch this application. But one thing you always want to do, one of the very first things when you're creating a GTK application is you need to specify what the program should do when you close the window. Because if you just close the window, there could still be a process running in the background that you don't know about just sucking up all of your RAM. So you always need to specify what to do when your window is destroyed. So in this case, what I'm going to do is let me get into insert mode. I'm going to do gtk.onWidgetDestroy and then specify what widget we're talking about, in this case, window. So onWidgetDestroy for when, I want you to run this function here gtk.main quit. So I want the program to completely quit when the window is destroyed. And finally, we need to specify exactly what we want to do when we launch the application. When we very first launch the application, what we want to do is we want to do a pound sign or a hashtag here. So hashtag show all space when. So when the program launches, what should it do at the very beginning? It should just show us the window, the window we created. Now let me write that and now let me get out a full screen here because I'm going to go back to the terminal here. And I'm going to run. Let me clear the screen so you can see here. I'm going to run stack run. I'm going to zoom out a little bit here in the terminal because I think you guys are not going to really need to see any of the text here. All I have that all I have that terminal open for is simply to run stack run every time I'm done here. So let's run that. And it did not compile correctly. And I'm going to look here at the errors here. Just looking here at the errors, it did not like GTK window type top level. Now the good thing is the Haskell compiler is pretty smart. So it didn't like GTK window type top level, but it tells us perhaps you meant one of these two libraries and one of them is GTK window type top level, but without a capital L. It's just a lower case L. See I thought top and level were both capitalized, but a level actually is not. So all I need to do is get back into the document here and let me just change that capital L to a lower case L and write that.  So now I'm getting an error about show all win, that very last line that we put here. And the reason is these kinds of labels here that begin with the hash symbol, the pound sign, those are what are known as overloaded. And what I need to do, we're going to use overloaded labels and overloaded strings. Those are just naturally part of the gi.gtk library. So really before we started, I should have went ahead and added this. So above the imports, I need to add these two lines. We need to add language and then overloaded labels and then language overloaded strings because we're going to have several of these various labels here that begin with the pound sign. So let me write that and then go back to the terminal and run stack run. And it is still complaining here. And it's complaining about data gi base dot signals. And again, the Haskell compiler, it gives me a clue here, data.gi.base. Well, if I go back in my imports, I never imported data.gi.base. So let's import it and see if that solves a problem. So now, one more time, stack run. And I'm looking at this, you know, and I always keep all of my mistakes on camera because I like to see you guys, I like for you guys to see how I figure out errors and solve problems. It's this line because Emacs is smart enough to also tell us it doesn't like hashtag show all and win. Which win, we've already defined that widget. I don't know why it's saying that this variable is not in scope because we defined it. It's right here. So something very wrong is happening here. So just looking at this, I see the problem. All right, so I'm glad I did this on camera, right? So the two lines here for overloaded labels and overloaded strings, they needed to be at the top. They needed to be above module mainware and all of the imports. Let me write that. And now, what do you want to bet that stack runs? It actually works this time. And it compiled correctly and there is our window. Now, we don't have anything to actually close the window here. In my tiling window manager, I have a key binding that will close the window. And we told the applet exactly what to do when the window was destroyed, quit the program. So there shouldn't be any kind of weird, like hidden processes that are still running. Now, the next thing I think we should do for creating our logout program, let me launch OB logout again. I'm going to create the same seven options here in my logout menu. So I need seven images because they were using images for the buttons. I'm going to do the same thing. So let's create some images. So let me create some space here and I'm going to do IMG1, image one. And then once again, the left pointing arrow. And then we're going to do gtk.image new from file. And then what we're going to do is a dollar sign. I'm going to do home, which is my home directory, plus plus. And then the path to where I have these images on my system, which I'm going to have them in the directory that I'm currently in, which is in my case, nc slash get lab dash repose slash source slash bye bye slash. And then the name of the images, the very first one was the cancel button. So I'm going to create a cancel dot ping. I've already created the ping images off camera. Now for those of you new to Haskell, the dollar sign here is the same as basically wrapping all of this in parentheses because I have to wrap this in parentheses to concatenate the home variable to this string. But a simpler way to do that is just putting a dollar sign. The dollar sign means there's an opening parentheses here and tack a closing parentheses at the end of the line. That's all that means. Now the home variable we haven't actually defined. So let's go ahead and define home. So I'm going to do home. And then once again, the left pointing arrow. And we're going to use this particular Haskell function called get home directory. Now get home directory is part of a Haskell library called system dot directory. So what we want to do is we want to go to imports. And I'm going to paste this here import system dot directory. And let me write that. And let's go ahead and see if this compiles. Now we haven't actually added the image to the window. I just want to see if just assigning the variables actually works. So let's run stack run. And it's good when you make simple changes to see if things compile. Don't make massive changes and then see if your program compiles because then it's not obvious the mistake you made because, you know, right now I've only added three new lines to the file. So it's really easy for me to figure out what the error is. And the Haskell compiler is complaining about import system dot directory. The reason it's complaining about that is because there's something we need to do. We need to add the system dot directory library to our package dot yaml. Remember that that was in part of the files that were created when we ran stack new name of project.  You guys remember this file. Remember at the very beginning where we went to the dependencies and we added gi dash gtk and Haskell dash gi dash base, et cetera. Well now what we want to do is add directory. That is the actual program name for the system dot directory libraries. It's simply called directory. So let me write that. And then let me go back to this here. And I haven't really made any changes to the main dot HS. I think all I need to do is just run stack run. And what stack is going to do is it's going to install system dot directory for us. And then of course it's going to run the program. So now it compiles correctly and it runs correctly. So let me make this full screen once again. So now we've got this image here and then once again for sake of time, and we're going to have seven images. So I'm just going to do a copy and paste job. We're going to have images for cancel, log out, reboot, shutdown, suspend, hibernate, and lock. Now exactly how should we add the images to our program? Well, let me do oblog out one more time to see what they did. And it looks like what oblog out is doing is they're using a grid. Right? So a grid and in the top row, they have the images. And in the second row of the grid, they have labels for the images, you know, cancel, log out, restart. That's exactly what I'm going to do. So we need to create a GTK grid. So I'm going to create a grid. I'm just going to call it grid because it will be the only grid for this application. No reason to give it some long and complicated names. So I'm just going to assign this variable as grid. And of course that needs to be GTK dot grid new. And then I'm going to paste these lines here while I'm at it. I just want to assign some other various settings to the grid. So what I'm going to do is I'm going to make the column spacing 10 pixels. Now the column spacing, of course, is going to be the spacing horizontally. And then I'm going to set the row spacing also to 10 pixels. That way, everything has a little bit of padding around it inside the grid. And finally, I'm going to do grid set column homogenous. I'm going to set that to true, meaning I want all the columns and rows and every I want all the cells in the grid to actually be the same size. Otherwise, when you put bigger text in one grid and smaller text, and they'll be different sizes, I don't want that. I want everything to have this homogenous spacing. So we created our window. We've created a grid. We've defined our images. And now there needs to be labels for each image as well. So to create labels using Haskell's gi.gtk library, you name a label. I'm just going to name them very simply. So I'm going to do label one for the very first label. And then once again, the left pointing arrow. This time we're going to do GTK dot label new. And I'm going to do nothing. I'm going to set it to nothing. Now, typically this takes a string. You know, you would actually give it a label like cancel. You know, that's the name of the button. But I don't just want plain cancel. I want actually this to be bolded text. And the way to do this using gi.gtk is to initially set the label to nothing. And then after that, do GTK dot label set markup for which widget label one. And then the string with the markup. And the markup, I'm going to use the bold tag. Standard B for bold for HTML. So I'm going to do B for bold cancel. And then the ending bold tag. So that is that label. And then I'm just going to create six more for logout reboot shutdown, suspend, hibernate, and lock. So let me just do a paste here. And you can see how that works. So now we have seven images, seven labels. Now let me launch OB logout one more time because these images here are not, they're images, but they're images set within a button. Because you see when I hover over them, you get some coloring around them, like a border around them. That's because there's actually a button here. And inside the button, the image was placed. So we actually need to create seven buttons for these seven images to go in. Then we need to create actions for each of the seven buttons. So actions would be when I click the button, what does it do? So let's get out of that. And let's go ahead and create a button. Create a button using gi.gtk. You give it a name. I'm going to, again, once again, very simply name these. I'm going to call button one, button one. I'm going to do gtk.button new. And new needs to be capitalized.  And then I'm setting that for button one. And what set relief is doing, it sets the relief, meaning the border and how the button is decorated. I don't actually want any decoration for the button. I don't even want the button to appear, because I'm going to put this image in the button. But really, all I want it to be is an image. I don't want anything else to this button. So I'm going to set this to gtk.relief, if I can spell, style none. So we created a button. We gave it a relief style of none, meaning there's really nothing to this button. So let's add something to the button. So gtk.button set image. And we're setting this, of course, for button one. And then I'm going to do the dollar sign, because again, this is the same as doing parentheses. I would have to do parentheses for the next part here, which is just image one. So we're setting the image inside the button. What are we setting it to? We're setting it to image one. That variable that we set earlier, if I scroll back up, image one is the location to that ping file there. Next, I want to make sure that the buttons don't expand vertically and horizontally and all of that, because it's going to look really weird. So I'm going to do a gtk.widget set h expand for horizontal expand. And then button one is the widget we're setting, and we're setting that to false. So I don't want a horizontal expansion. I don't want the button to resize, whatever the button size ends up. When I put the image in it, that's the size of the button. And finally, we need to create some kind of action for this button, because right now we've got the button. We put an image in it, but what happens when I press the button? Well, you need to do the following here. You need to do on button one, and then hashtag clicked, then dollar sign do. So this will be a do block. A do block is needed when you're going to run multiple commands as part of a function here being defined. So I'm going to do put string line. This is essentially printing to standard output. And I'm going to print user chose cancel, just letting me know in standard output that I pressed cancel, the cancel button. And then I also want you to run the following function here, gtk.widget destroy. What widget am I destroying? I'm destroying when the window just closed the entire program. Now let's actually stop for a minute, because we've done a lot here. I'm going to write that and let's see if this actually compiles. I just want to see if it compiles correctly. It's still going to be an empty window. Yeah, still an empty window, because even though we created those widgets, we haven't actually placed them inside the window just yet. So let's go ahead and actually start adding stuff to the window so we can see the buttons and images and everything. See if the stuff actually works. So I'm going to go back down here to where I added the grid. We need to add the grid to the window. So the very first thing we need to do, we create the window. Then we add the grid to the window. And then we need to add the buttons to the grid. Then we need to add the images to the buttons. You see how that works? There's a certain pattern here. So I'm going to do hash symbol add, and I'm going to add to the window the grid. Now the grid is empty, so we still won't see anything just yet. So now we need to add to the grid. The way to add to the grid is you do hashtag attach, and then we're attaching to the grid button one. I'm going to add button one. Let me create some spacing there. And then I need to give it four numeric values here. The very first two are kind of like x, y coordinates. In this case, it's going to be zero and zero. So what we're going to do is we're going to place button one in row zero because in programming, you always start counting at zero, not one, right? So we're going to place button one in row zero, column zero, and then how many rows and columns should button one take up? It should take up exactly one row and one column. And then when we defined button one, we already added the image to button one. So let's write and run stack run, and see if it compiles, and see if we actually see a button now. All right, so we see a button, and if I click it, it quits, but you notice the image did not load because I haven't actually put those images in that directory just yet. Let me actually open my file manager. And I created these images earlier today, so give me just a second to navigate to where I had these images saved earlier. And these were just standard icons that I found on my system as part of an icon pack that I kind of repurposed for purposes of this video. Some of them I edited slightly in GIMP, so I'm just going to paste these. I probably should put these in their own directory actually. What I probably should do is create a new directory here. I'm going to call it IMG for image. And let me actually paste those seven ping files into that. And then that way I'm not cluttering up essentially the root directory of this project. Now we get rid of those. All right, so now let me go back to where I defined the location of those images. And what I want to do, a good thing, is evil mode here inside Emacs, or if you were using Vim, this works here. I'm just going to get into visual block mode and I'm going to do a change. And I'm going to change all of those lines to slash IMG slash and hit escape. And I just changed the path to where all of those are. Now let me write and get back into the terminal. Let's run a stack run. And there is the cancel icon. I click it. It does a main quit, right? Or it does a widget destroy on window. So now let me get back into the file. So we have the image loading. Now we never did add label one under image one. So we wanted label one, which says cancel to be under that image. So how we do that is once again, go to the attachments for the grid. Actually, I'm just going to YY to copy and then P to paste. I'm going to attach to grid. And we're going to attach label one. Let me space this so everything is nice and even makes it easier to read. Label one needs to be in the zero column position again. But this time we're going to make it row one. So one row lower than button one. So just under it. And again, it's going to take up one column and one row. That's right.  Now see if now we have an image and a label we do and the label is bolded because we added that. So now we just need to add the other six images and labels. So let me go back to button one. So what we need to do is we need to create buttons two through seven. And basically we just should copy this, copy it six more times, and then just adjust the settings to what they need to be. But I've already done this off camera. I'm just going to do a paste here. So we create a new button. Once again, relief style is none. We add image two to the empty button two. And this time what this is is the logout. So when we click button two, what I want you to do is print the standard output. User chose logout and the command to logout. There's not really a good command to kill Xmonad.  Actually Xmonad-X86 underscore 64-Linux. If you wanted a more nuclear option, you know, I could use this here, which is call command, which is a way to run system commands using Haskell. And I'm going to run pkill-u and then the name of my user. So kill all the processes that my user started, which would include Xmonad. So it's just going to kill everything and kick us back out to my login manager. Now you notice call command has this red squiggly line under it in Emacs, meaning that is not in scope. That particular command, that function, is because call command is part of a library we have not actually imported. That is part of a system process. So let me go back to the imports and add system dot process to the imports. Also, we never defined the user variable that I was using. If I scroll back down. See, we're going to run pkill-u and then plus plus user. That variable, well, what is user? Well, let me go back to where I defined home. That particular variable, we're going to do user. User is going to be get effective user name. So this is a Haskell function that gets your user's username. Now this particular function, you see, it's in red because that's part of a library that, again, we have not actually imported. And I know this one is part of system dot posix dot user. So let me go to imports and I'm going to import system dot posix dot user. Let me write and you see the red line goes away. So this variable is fine here. And if I go back down to the button where we were doing the call command, you see, there's no error there anymore. There's no error on user. So all of this should compile. So let me go to the terminal and do a stack run just to verify it compiles correctly. And it does not. It's complaining about importing system dot process and system dot posix dot user. You guys by now probably know why that is, is we can't just import libraries in our main.hs. We have to do it a second time with the stack package.yaml file. So let me go back into the package.hs. Back into the package.yaml file. We need to add a couple more programs here. So system dot process, that particular package is simply called process. And then system dot posix dot user is part of the unix package. Let me write that and then get back into the main.hs. Write that and then do a stack run. And this may take a second because it's going to install the process package. And it's also going to install the unix package. And then it runs the application and yeah, everything is working. Now we added the buttons, all seven buttons and their actions and everything, but they're still not part of the grid. That's really the last thing we need to do. So what we need to do is do an attach to grid button two, and then attach grid label two, and then do the same thing for button three, label three, button four, label four, etc. Once again, to speed up the video a little bit, I'm just going to do a paste here. And you can see button one, label one, button two, label two, etc. And you see button one, label one are at column zero that position. And then right next to them in column one would be button two, label two. And then next to those in column two would be button three, label three, etc. If I did this correctly, let me write, and if I do stack run, we should actually see seven buttons and seven labels now. And there you go. We have seven buttons, seven labels, and did they actually work? I know the cancel button works on video here.  It's going to kill all the Emacs buffers I have open and everything. I will show you the very last one, lock. Now what I did, let me close the program before I start hitting the buttons. What are the actions? Well, the very last one runs call command S lock. That is a Sucluses lock program. So you'd have to have S lock installed on your system for this to work. But what it will do, let me do a stack run, is when I click that it'll run S lock. Now S lock just turns the screen black until I start typing my password. If I type my password correctly, the screen turns blue. And when I hit enter, boom, I'm back in my machine. Suspend, does a suspend, hibernate when hibernate, of course. And yeah, you guys know the rest of the commands. That was really very simple. I'll show you the command system CTL. So system D commands for suspend and hibernate. I did a shutdown dash H now for shutdown. A simple reboot for reboot because on ArchBase systems, most system D distros, you just simply need the word reboot to reboot.  So that was a rather simple little program, right? And let's compare it to OB logout, right? This particular program, right? How quick was that for us to recreate that? Well, let me, once again, just for comparison, run our little program bye-bye, right? And all the buttons work. I will verify. I actually checked it off camera because I did create this before starting the video. It took me under an hour off camera from start to finish to create this little GTK application using Haskell. And this stuff isn't hard. I'm going to actually push this application to my GitLab. I'll put a link in the description where you guys can actually find the source code for this for those of you that want to check it out. Obviously, you want to check it out. This is your first GTK application. So you guys can maybe use it as a study guide or for those of you that just think it's a neat application. Maybe you want to push some commits to it. I may actually use this application, even though I was really using it as an example. I might actually keep this program around. I may actually package it up, create a binary for it. Maybe even put it as part of DTOS in the future. Now, obviously, this was a very basic application to create. You didn't really need to know any Haskell. To create this application, especially with me, just giving you some of the libraries and function names and things like that. Once you get into more complicated things, where the buttons and widgets and sliders and everything actually have to perform more complicated actions, then you actually have to start writing your own Haskell functions, which is a deeper topic. But we're going to get into that, I think, at some point. If you guys want to see more Haskell, more GTK, let me know down in the comments. Before I go, I need to thank a few special people, though. I need to thank Devin, Dustin, Gabe, James, Max, Matt, Michael, Mitchell. I almost messed that up. Paul, Scott, Wes, Helen, Armour, Dragon, Chuck, Commander. Okay, I did mess it up. Commander, Angry, Dio, Kai, Dylan, George, Lee, Lennox, Ninja, Marsha, Mike, Erion, Alexander, Peace, Origin, Madore, Polytech, Realiteats for Los Merid, Prophet, Steven, Willy, these guys. They're my has tiered patrons over on Patreon without these guys. This episode about creating this logout program using Haskell and GTK, it wouldn't have been possible. The show is also brought to you by each and every one of these. Fine ladies and gentlemen, all these names you're seeing on the screen right now. These are all my supporters over on Patreon because I don't have any corporate sponsors. Corporate sponsors wouldn't sponsor this stuff. I depend on you guys. If you want to see more videos about Lennox and Brain open source software, subscribe to DistroTube over on Patreon. Peace. Maybe I should create some GTK games for DTOS.