Haskell Weekly


GHC 9.2.1

Listen on Apple Podcasts
Listen on Google Podcasts

You can also follow our feed. Listen to more episodes in the archives.

We’re back! After a month off, Cameron and Taylor get together to talk about what’s new in the Haskell world.

Episode 55 was published on 2021-11-08.



>> Hey there Haskell Weekly listeners. Welcome back to the Haskell Weekly podcast. It's supposed to be weekly, but it's been about a month since our last one. Apologies for that. I'm your host Taylor Fausak. I'm the director of software engineering at ACI Learning. And with me today as per usual, is Cam. Thanks for joining me, Cam.

>> Hello, hello. It's good to be back. I know we've been trying to do this for a little bit. Um, but yeah, my name's Cam Gera. Uh, I am a senior software engineer at MotoRefi, so, uh, yeah, excited to be here today. And, uh, we got some fun stuff, um, recent released in the Haskell, uh, ecosystem. And so we're excited to share that with you guys and, um, honestly just spend some time and break it down, be a little more casual today. Um, you know, get, get to here. Cause I haven't really heard what Taylor's went up to in a minute. So Taylor what's been going on over at ACI Learning,

>> all kinds of stuff. The big ticket item is merging with practice labs, uh, who is not exactly a competitor of ours, but another company in the same space who has a complimentary skillset and product offering. So. Uh, my life recently has been talking with the folks over at practice labs and trying to identify some commonalities between our engineering orgs. What can we share? What do we do differently? What do we each — uh, which unique skills do each of us bring to the table and can we share with each other? So that's been going great, really looking forward to continuing that. Um, and for me personally, uh, I've been doing some work on the Brittany code base, which is a Haskell source code formatter, uh, that we use here at ACI Learning. And it hasn't been updated to support GHC 9.0, which came out a while ago. And today we're going to be talking about 9.2, but, um, I'm trying to bring it up to date and make it work so that it can be used as part of H L S.

>> Ooh nice. Yeah, we, uh, haven't been using uh Brittany and we used it for a minute. Um, but we've been focusing more so on fourmolu. So we're using ormolu's I dunno, customizable brother fourmolu and, uh, that's been surprisingly good. Um, I know there's a couple more things that still need to be implemented in fourmolu to make me not, uh, my eyes not burn. Um, when I'm looking at, you know, some Haskell code, uh, cause right now like, oh dude, the one that's most frustrating to me is the trailing arrows. So if you have a function with multiple parameters and in the type signature if you have. you know oh so long. And you want to divvy it up. It's like, everything's at the end of the line. And it's, I'm like, ah, I don't like this. It's just, it's just different from the norm. Um, if you're a normal user, I get it. You, you like that? That's

>> cool. Yeah. I've always said that I don't really care what the formatting looks like. I just care that it's automated, but, ormolu has really. Pushed that pushed me to be honest about that. Like, I do care a little bit about how it looks and I don't like how ormolu looks, but I do like everything else about that project. Like it's well-maintained and they have a lot of good tools and they have like check mode and they have a GitHub actions for running it. I think all that stuff is great. And I'm going to try to do the same for Brittany. Nice.

>> That'll be good. Yeah. I mean, when we were kind of thinking since, you know, really last time since the last time we've talked, um, you know, at MotoRefi we've just been. All out on, uh, creating a new product and that's really what the team I'm on and, and what we're focusing on. So, um, for me, it was all right. We just need to pick a formatter for now and go with it. And so we thought about Brittany thought about ormolu and then fourmolu was there and I was like, alright, I can get on board with fourmolu. Like, that's fine. Let's, let's move forward with it. So, um, you know, I didn't really make too much of a fuss about either. Um, because at the same time, like you said, it's automated, like as long as it's automated and it works. We're good. Um, that, that's what we care about. So, um, that's kinda my stance on where, where we're at at

>> the moment. So other than source code formatting, what else have you been up to? You said building a new product. That's exciting greenfield's always fun. Yeah,

>> yeah. Yeah. It's been fun. So, um, we've been of. The previous product was a monolith with its giant code Ruby code base. Uh, and we're not touching that. So we're actually, um, actually going though with a microservice architecture, um, with event sourcing. And so, uh, At the beginning, I was a little bit like, wait, what, why, why are we doing this? And I'm still like every once in a while, like, ah, I wish we had like more shared code, but we're really trying to get better about bounded context. And that's kind of the whole push for, uh, event sourcing and, uh, microservices. So, you know, we created four new services in the last month that, um, kind of uses event bus as more or less or event log as more of a less. Means to do actions. Um, you know, so obviously we have an endpoint that will take the information, uh, that is needed and push it into this event log event stream. And then we'll have, we have a couple services who listened to various, uh, events on that event log. And so that was, uh, it's been fun. It's I was impressed with how fast we were able to iterate. Um, we got all four services up with. A week before our deadline. Um, and so, uh, it was yeah. All out. Um, and now we're just kinda starting to add some more services and different, uh, things that we wanted to be able to do after MVP. So Monday is our official launch.

>> You say that's the power of Haskell you're able to deliver quick, more quickly than the old fashioned Ruby services.

>> Yeah. Yeah. I think it's. Proven that, you know, Haskell does really work well in production. And, you know, you can start up a whole Greenfield project and have it done in three weeks. Uh, and that's cause that's what we did, you know, and it's, you know, obviously kudos to our team. Our team did a great job, uh, but also kudos to Haskell. It gave us that opportunity just to start go, compiler is going to help us hold our hand along the way. And you know, we'll kind of make choices and ideally that generally they're pretty good choices. So, you know, we are using servant as like our server. Um, and that was kind of, you know, repeated through for like a health check for each service, just to make sure that the thing is up and running. Um, and so that, you know, was all pretty easy. And actually another cool thing we got to do in that process was create a stack template because a lot of our services have the same. And so we, anytime we need to start up a new service, we just use stack new the name of it in the template name and boom, you got all the lines of code. You need generator for you, uh, what the name populated through. So that was a pretty cool like experiment we did. Um, as after we created the first service, we did that to create the rest of the services. It, uh, set us up for success there, for sure.

>> Yeah. Cool. Well, thanks for sharing. I look forward to hearing more in the coming weeks about how this project develops, um, cause I'm sure like you mentioned, you know, just picking a formatter, just getting some something out there is really good. And I think one of the strengths of Haskell is being able to change it later, refactor it confidently. So I'm curious if y'all have any interesting refactoring stories.

>> Oh yeah. That's that's our, after, after lunch we have our next sprint is to kind of come back together. Talk about the decisions you made, figure out if that's really what we want to do, get some consistency in the code base because you do, we want to qualify imports. Do we want to, you know, just important, the whole fricking module. It's like, well, how do we want to write our code? And so that's something we're going to be coming back to. Um, So I'm sure I'll be able to update you guys with that next week and the following weeks. So, because our goal is to make Haskell weekly. This is the goal weekly being the key word there? Well,

>> uh, so let's get into some of the news from this week. Uh, we'll start with maybe the smaller ticket item, which is the Haskell weekly survey. The state of Haskell survey, um, is out, I released it on November 1st and it will be open for two weeks, which is through November 15th. Uh, I do this every year. I've done it for the past four years. So this is the fifth year. And, um, yeah, it's just a, your opportunity as a member of the Haskell community or somebody interested in Haskell, if you don't feel like you're part of the community. To weigh in on how you think Haskell as a language is what you think of the community, how things can be improved, all that. And I'll do what I've done every year, which is post the results at the end and do a little bit of analysis. So that cam you asked earlier, what, uh, what have I been doing recently, uh, gearing up for that? So, uh, the survey is a little bit different this year to overlap more with some other programming communities and also. Looking forward to next year, the Haskell foundation will likely be taking over the survey. So this year is kind of a transitionary period for that. Nice, yeah I was actually

>> just about to ask like fast Haskell foundation hasn't taken it yet.

>> Not yet. So I've been talking with Andrew Boardman, who's the executive director of the Haskell foundation. Um, and they're definitely interested in taking it over and reshaping it just a little bit. Uh, Yeah, that will happen next year. So this year it's still just me. Um, but I'll continue to do what I've done previous years. How much

>> did you charge him to take it? I'm just kidding. It's all for the community.

>> Yes. Um, so yeah, if you're listening to this, please, uh, I'll leave a link in the show notes, or you can just head over to Haskell weekly.news and there will be a link there. Go take the survey, tell everyone, you know, to take the survey. I think we're up to, we're recording this on Friday the fifth and it's up to about eight or 900 respondents. So trying to push that number up. Yeah. Uh,

>> I'm guilty of not doing it yet, so I need to step up my game apparently, but that's why we do Haskell weekly so we can remember to do things like this. So thanks Taylor for that to, yeah, I think it's exciting. I always enjoy it. I just need to. Sit down and do it.

>> Yeah. It'll take about 10 minutes.

>> Just like Shia LaBeouf just do it yesterday. You said tomorrow.

>> That's right. Um, but yeah, that's not the big ticket news from this week. Cam, You want to tee us up?

>> Drum roll, please? It's probably like, uh, yeah, whoever listens to this. I'm sorry. Yeah. GHC 9.2.1 has been released. Woo. Ooh. So there's a lot of fun, cool things that happened with this release of GHC. Obviously it's going to take a little bit of time to get Stackage up to date and all that fun stuff. Cause, uh, but yeah. Why don't you share Taylor, since you let me do the announcement, why don't you share some of the highlights that are coming. Sure.

>> So to start, there are just so many new things in this release. Uh, we're not going to have time to get into all of them. Otherwise, this would be like a two hour long episode, but I'll leave a link to the, uh, release notes, which I encourage you to go read. We're just going to hit the highlights. Uh, first big one, which isn't, um, a change to like the code or anything like that, but a change to the code generator on the back end is that GHC can now produce native code for the apple architecture, which means all those fancy new MacBooks and Mac book, uh, excuse me, Mac minis and those new MacBook pros. Uh, you can now compile GHC that will run natively rather than get interpreted through the Rosetta, um, you know, changing from x86 64 into arm 64. So, uh, that just means it'll be faster, better tighter integration. I think there were also a lot of kind of incidental, um, changes or improvements to the code generator. As a result of this were needing to differentiate between arm 64 and x86 64 made things more, um, like precise. So one of the things is like a word eight data type I think will actually be smaller. Like only use eight bits rather than it used to, I think take 64 bits. Go read the release notes. There's way more information about that. Just exciting native on M1

>> yeah. So that means a Haskell community can be more, uh, more apple purchasers I'm in, I don't know that M1 Macs and M1 pro look pretty cool. I don't know, per their comparisons with like the I9 and

>> whatnot. Yeah. They're super fast. I, myself, have an M1 Mac mini at home. Uh, and I also have a windows machine. Also. I have a Linux machine, so I use GHC on all those I haven't yet got nine dot two on that Mac mini. So I can't, I don't have an experience report for, oh, it's blazing faster. It's super slow, but I expect it to be blazing fast. Yeah.

>> We'll have to, uh, check in with you on that next week. See how That's going a little pet project. Ah, cool. Yeah. Um, I, I don't know if you can hear Roomba I just. That's running off in the background, DJ Roomba, DJ Roomba. But yeah, so, uh, I know there was a lot of changes in the area of records. Um, you want to talk about some of the language extensions, um, that they, uh, added and, or

>> modified. Yeah. And I apologize in advance. If I get any of these wrong, I haven't been paying close attention to all of the proposals and implementations of these things, but yes, there are a lot of changes. Records and record fields. And the end result is that you can now write code in Haskell with the more typical record dot field notation that is popular in most object oriented languages. And you can have that read a real field on a record. So if you define like a person type and they have a name and you can now say person.name, Read that field out. Um, or you can have synthetic fields where it's computed when you call it or something like that. Um, like I said, I haven't been paying super close attention to this, but that's my understanding of it. And this also rounds off some of the rough edges when it comes to records where you can have, um, multiple fields with the same name. And then when you do that dot access into them, it will disambiguate based on which thing it is that you're calling. Um, and, uh, I think record updates. Are they also changed in this release? I think they're still changing, but the idea is that, uh, you will be able to do a record update, which is in the curly brackets where you say like a nested field in there where you can say person dot, name dot first equals something. And it will do a deep update into that. Rather than forcing you to like unwrap each level along the way and update the very inner thing.

>> That'll be nice I feel like, uh, one thing that, one other language that could use something like that would be, uh, at least for like the. Changing of fields would be Elm. Yes. Gotta to like unwrap each section and then go to do the thing and then rewrap it. And it's like, uh,

>> yeah, it's all this boiler plate for basically no reason. And in Elm, you can't even use lenses, which is the common Haskell way around this problem. And maybe the best way to talk about the record updates in GHC nine dot two is that it gets. Core language with some extensions, closer to what you can currently do with lenses as a library. So I'm sure that people who use lens may see that as a downside, like, Hey, you know, we have this powerful thing that we were able to implement without language support, but I know that a lot of people in the Haskell community are they shy away from lenses. And so having it built into the language is a big plus.

>> That's been something for us is like, kind of figuring out, alright, what packages do we want to use? And what are the side effects with that? Oh, what's going to, you know, use lenses to, for updating documentation with swagger and it's like, all right, what is the dot tilde? Do? What about the dot till the curly or question mark? Oh yeah. That's what all these do. So, uh, yeah, I think, uh, creating some more language support for things like that without having to use lenses. Um, another thing one we've already talked about previously, uh, in a, in a previous episode is the GHC 20, 21, uh, language extension set. And so I think with 9.2 0.1, that is now a supported thing. Um, and yeah. What

>> do you think about that? I'm really excited about this. And in fact, uh, in reading the release notes, Discovered something about this that I didn't know before, which is that when you're defining a Haskell project or package, I should say, in your cabal file or your package dot yaml, you typically say what your default languages and you pick one of the language reports. It's either Haskell 98, or it's Haskell 2010. And for the most part, those are interchangeable uh Haskell 2010. Isn't a radical departure from Haskell 98. It just shores up some things and enables. Um, I'm small extensions, but I think with this new release, if you don't specify a default language, you're going to get GHC 20, 21 by default, which means a lot of new extensions. They don't actually list the whole extension set here, but there are. Tens of extensions that this enables and it's, you know, there was a lot of feedback that went into this, um, partially motivated by the Haskell survey. So again, please fill that out. If you haven't shameless plug. I love it. Exactly. Um, but yeah, so it's stuff like, you know, uh, Lambda case or like multiparam type classes, I'm rattling these off, but I don't actually know that these in particular are enabled, but they kind of quality of life improvements that feel like they should be on. But haven't been because it's such a conservative language standard. Now they're bundled into this GHC 20, 21 language set and I'm really excited.

>> Yeah. I know numeric underscores is in there. I was, uh, working with a buddy and I was like, he enabled uh that, and I was like, this is weird. Like I just haven't used this before. And he's like, yeah, well it's in GHC 2021. I was like, all right, cool. Let's do it. Uh, so yeah, I've definitely had my fair share. like hm this could be nice, just to be here. Uh, I think we've got quite a few language extensions ourselves, so be cool to see how many of those overlap with GHC 20, 21 and how many we're not using. And maybe that would be another helpful thing to, you know, iterate quickly.

>> Yeah. And one of the things I really like about this is that it provides a common base or common subset for the community to kind of rally around. So right now I think the status quo is. Everyone has kind of their own mental checklist of that's a okay extension. That's a bad one. And this one I'm kind of ambivalent about, and maybe not for every extension, there are a bunch, but you know, you say undecidable instances and some people are like, Ooh, I hate that. Or, oh yeah, that's fine. I'll enable that, whatever. Um, and by having a group of stuff altogether in GHC 20, 21, we can as a community, just say like, this is what I'm using you're probably already familiar with all of it. This is our new baseline. All right. Let's have all these features and make development life better for

>> us. Yep, exactly. Yeah. So that's, that's good. Uh, that's another great win for GHC 9.2 0.1. Uh, are there any other like topic talking points? I mean, like you said, we could talk for hours on this. And I want to be cognizant of everyone's time, including yours. Now you're a busy man with talking to people over the pond and whatnot.

>> You're busy too working on that new product, but there is one more thing I wanted to talk about, um, which is GHC exact print. And at the top of the show, I was talking about Brittany, the source code formatter Brittany is actually built on top of GHC exact print, which used to be a separate library. And if you're not familiar with it, GHC exact print is sort of like the pretty printer that doesn't actually make things prettier. All that it does is parse your source file into an AST and then give you back exactly the same thing. Hence the name, exact print. This seems kind of useless, but it's actually really useful for doing refactorings. So if you want to parse a file and then say, Something that HLint does a lot, for example, is like, if you have an expression where you say, when not something do this, you can replace that with, unless something do this. And HLint actually leans on a different tool to do those refactorings. But with GHC exact print, you could implement those types of refactorings by parsing the AST, and then transforming the little part of the AST you're interested in, and then writing it back out to a file. Or obviously you can use it as the basis for a pretty printer where you parse the AST and then transform not the, um, like not what it means, but what it looks like. And then write that back out to a file. So, uh, I mentioned all this, the, the actual change in GHC nine dot two is that exact print is now part of GHC. So it's no longer a separate library. And that just means. More widely available. You're guaranteed. It's going to be up to date. Those are good things.

>> Yeah. So in there, in that explanation, you did use a couple acronyms that I wasn't sure of. Um, and for the listeners, I want to make sure that they are also not in the dark there. Um, I think you said AST.

>> Yes. So AST stands for abstract syntax tree. And what that means is typically the. Like the source code you have in a file is just a bunch of bytes, they're characters, whatever, how are you, however you encode them. And then the compiler doesn't want to deal with those bytes directly. It wants to deal with an abstract representation of them. So programming languages are typically typically pretty complicated, but the same thing is true for like JSON, you have like curly bracket, double quote, something close, double quote colon, and like, okay, that's great. But really what I'm representing here is JSON object, key name is this and value. So an AST is essentially like a abstract representation of the syntax. Gotcha.

>> I feel like there was something else, but I can't quite call it out. And I know it's not an NDA cause that's something else. Uh, so, well, if whoever's listening and they re see which one that was and have a question. Pink Taylor. He'll, he'll answer it for you. Cause I mean, you can pay me, I'll research it, but I can't guarantee the answer.

>> So ping you and then you can ask me and then I'll tell you and perfect. Tell

>> them I will just play telephone with this. Sounds like a great idea. Awesome. Well thank you, uh, for kind of diving into those, uh, today and sharing with us, uh, Really are some of the highlights and top points of GHC 9.2 0.1. Please do go look at the full spec if you're interested in what changed. Um, cause there's a laundry list of things. So, uh, definitely check it out. Uh, hopefully soon we'll continue to get every stack supporting 9.2 0.1 and, and all that fun stuff. So. Now that it's officially been released, we can kind of wait for that ball roll for all the, the full support for normal. Uh, you know, obviously you can still use 9.2 0.1, but if you want it, you know,

>> it's a lot easier when stackage has at least a nightly snapshot for nine dot two dot one. Cause that means most of the libraries you probably depend on have been updated to support it. Um, and my expectation. As someone who maintains a handful of libraries is that upgrading to nine dot two is probably going to be a little bit easier than upgrading to nine dot. Oh. Um, from the change from eight dot 10 to nine dot, oh, there were a lot of internal changes in GHC restructuring and stuff like that. And so that made it hard for libraries that depend on those internals to update. And it seems like there aren't as many with nine dot two.

>> Cool. Well, thank you guys for listening. Uh, yeah, you want

>> well, uh, I want to add one thing to the outro and then you can do the normal bit, which is, um, if you guys have you listening, have any questions about, you know, stuff we talk about on this show, or if you have suggestions for things you would like us to talk about, please let one of us know or tweet us at Haskell weekly. Um, I would really. Like to get into questions from our listeners and, you know, I, should we do this or that? Or should we architect things this way or that way? I think Cameron and I have a fair amount of experience working in professional environments with Haskell. And I'd love to share that with the larger community, but it's hard to just jump off of nothing. You know, we need a need a prompt.

>> Yeah. I would agree. Um, yeah. Sounds great to me. Well, awesome. Thank you guys for listening to the Haskell weekly podcast. Uh, we are a show about Haskell. It's in the name. That's pretty cool. Uh, if you guys are interested, please follow us @HaskellWeekly. Um, or you can find us online at HaskellWeekly.News

>> you got it. And, uh, as per usual, we are brought to you by my employer, ACI Learning. Uh, if you want to go over to it pro.tv and fill in promo code Haskell weekly 30, you can get 30% off the lifetime of your subscription. So thank you for

>> using, because our domain is it pro.tv and we were purchased by ACI Learning. So for, well, yeah, they were, uh, my previous employer, one of us, one

>> of us,

>> but yeah, I mean, I spent, I spent a long time there, so I feel like even if I'm not there, it's still part of it for some reason. Um, I mean, I did just walk into the building the other day and just walk on in.

>> Security's really light there, lose a ping pong game. I did

>> Taylor Fausak beat me on November 3rd, around 12:45 PM. Not a

>> big deal. We made a plaque, but it's not a big deal. Yeah.

>> It's no biggie. I was the reigning champion, but you know, now I'll cry away, but anyways, thank you guys for listening. We'll catch you guys next week. Peace.