hallettj

joined 11 months ago
[–] [email protected] 4 points 1 month ago

If the return type of a function is NonEmpty the value returned is guaranteed to be non-empty because it is not possible to construct an empty NonEmpty value. That's the "make illegal states unrepresentable" mantra in action.

At runtime you might get a list from an API response or something, and it might be empty. At that point you have a regular list. Following the advice from the article you want to parse that data to transform it into the types representing your legal states. So if the list is not supposed to be empty then somewhere you have a function that takes the possibly-empty list, and returns a value of type NonEmpty. But if the list actually is empty that function will fail so it has to be able to return or throw an error. The article uses the Maybe type for that which is one of the Haskell types for functions that can fail.

Once you have parsed the input list, and successfully gotten a NonEmpty value the rest of your code can safely access the first element of the list because a value of that type is guaranteed to have at least one value.

[–] [email protected] 5 points 1 month ago

Hey I had this post in mind just yesterday when I was working on some Mastodon client code to show comments on my static-site blog. Typescript is especially well-suited for deriving types from parsers. I also enjoyed brushing up on how to use JSDoc annotations and ES modules to publish what is effectively Typescript that runs in the browser without a build step.

[–] [email protected] 10 points 1 month ago

Scotty: How do you think I wound up here? Had a little debate with my instructor on relativistic physics and how it pertains to subspace travel. He seemed to think that the range of transporting something like a... like a grapefruit was limited to about 100 miles. I told him that I could not only beam a grapefruit from one planet to the adjacent planet in the same system - which is easy, by the way - I could do it with a life form. So, I tested it out on Admiral Archer's prized beagle.

Kirk: Wait, I know that dog. What happened to it?

Scotty: I'll tell you when it reappears. Ahem. I don't know, I do feel guilty about that.

Scotty in the 2009 Star Trek movie explaining how he wound up in an especially remote posting.

[–] [email protected] 6 points 1 month ago

And they're still on Sourceforge!

[–] [email protected] 4 points 1 month ago (1 children)

Everyone switched to Dropout, but the people counting overlooked it

[–] [email protected] 7 points 1 month ago

The figure in the article is 770,000 which is a bit over 0.2% of the population. They note that is an undercount. But I agree, the number has been way too high for way too long, and the rate of increase is very alarming.

[–] [email protected] 2 points 1 month ago (1 children)

I love Cartograph CF for the terminal and code editor. I like the handwriting-style italic variant, and it has programming ligatures. And of course I like the way the font looks.

There is an open-source font, Victor Mono, that also has a handwriting-style italic variant and programming ligatures. Otherwise its style is quite different.

[–] [email protected] 6 points 2 months ago* (last edited 2 months ago) (1 children)

I set my kid up with Silverblue recently. After seeing it in use for a bit, as a power user I think it's got some obnoxious compromises, and NixOS is a much better way to get the same benefits, and encourages safe experimentation at every level of the system. But for a beginner-friendly system that is very stable I think ostree distros like Silverblue make sense. Mostly stuff works fine, but you want to break out rpm-ostree occasionally to get a native package.

I have another kid on Fedora as a control. So far things are fine. Previously I had both kids on Manjaro, but they weren't able to keep up with upgrades long-term (over the course of a few years) without some intervention from me.

Like I said in Silverblue stuff mostly works nicely:

  • Bottles running from Flatpak is running games in Battle.net without problems
  • Minecraft is running from the launcher installed from Flatpak
  • Roblox is running using Sober from Flatpak

I think we may have installed steam natively using rpm-ostree. I think we ran into some sort of issue running Overwatch, and I quickly opted for the native steam package to get things working instead of trying to fix the issue using Flatseal. But I don't remember what that issue was so I can't say the Flatpack steam won't just work for you. Maybe it was very slow Vulkan shader processing?

My kid likes Minecraft mods so he needed java in his path to run installer jars. AFAICT in immutable distros the options for setting up CLI programs are either to run a different distro with native packages in a container (distrobox), or drop to rpm-ostree. I opted for the latter.

On the hardware side I think one of the biggest factors in building a snappy system is choice of SSD. Like you said, spinning metal is out. But the idea that SSDs are all equal is a common misconception. The thing to do nowadays is to use an M.2 form factor which is where you get a little board that goes into a slot directly on the motherboard, sort of like a small, sideways RAM stick. That plugs directly into the PCIe bus which gives it tremendous bandwidth. Drives that support newer PCIe versions can be faster due to having access to more bandwidth, but the design of the drive itself is also a constraint.

[–] [email protected] 8 points 2 months ago

Roblox on Linux has gone through some phases of working and not working. Currently it does work using Sober https://sober.vinegarhq.org/

I haven't tried Fortnite, but from what I've read I think that is a no-go.

[–] [email protected] 2 points 2 months ago

You can run Roblox on Linux with Sober. My son is a big fan! https://sober.vinegarhq.org/

[–] [email protected] 6 points 2 months ago

Docker Compose runs services, manages dependencies between services, isolates each service in a container, manages a private network. Out-of-the-box flakes don't do any of that - except arguably running one service at a time. What flakes do is build software, which is the thing that Docker Compose doesn't really do. (Or doesn't do well.)

I'd compare flakes to Makefiles with waaay more expressiveness and reproducibility. Or maybe a comparison could be to a Dockerfile, minus containerization, with waaay more expressiveness and reproducibility.

There are tools you can add on to get Nix to do what Docker Compose does:

Arion is a Nix frontend for Docker Compose. You're still using Docker Compose, but it layers on the extra expressiveness and reproducibility of Nix flakes, or other kinds of Nix expressions.

process compose flake is similar, but instead of Docker Compose it is a frontend for Process Compose. You get a similar result, but without containerization. That can potentially avoid the need to run in a VM on non-Linux systems that don't natively support containers.

[–] [email protected] 9 points 2 months ago

I had that symptom, and I found that my laptop was using S2 idle (suspend to idle). I fixed it by switching to S3 sleep (suspend to RAM). I suggest following the instructions in section 3 in this page: https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

Like many Arch Wiki guides, most of the information on that page is applicable to most Linux distros, not just Arch.

view more: ‹ prev next ›