We started producing shows as Today with a Techie on 2005-09-19, 13 years, 11 months, 6 days ago. Our shows are produced by listeners like you and can be on any topic that "are of interest to Hackers". If you listen to HPR then please consider contributing one show a year. If you record your show now it could be released in 5 days.
We are running very low on shows at the moment. Have a look at the hosts page and if you don't see "2019-??-??" next to your name, or if your name is not listed, you might consider sending us in something.
We take the ideas we have developed over the previous episodes and use them to evaluate a a study I found online. These are things anyone can do with just a little work on Google, and the payoff is to have a good idea of whether or not you are looking at a quality study
Type classes are Haskell’s way of doing ad hoc polymorphics or overloading. They are used to defined set of functions that can operate more than one specific type of data.
In Haskell there’s no default equality, it has to be defined.
There’s two parts to the puzzle. First is type class Eq that comes with the standard library and defines function signatures for equality and non-equality comparisons. There’s type parameter a in the definition, which is filled by user when they define instance of Eq for their data. In that instance definition, a is filled with concrete type.
class Eq a where
(==) :: a -> a -> Bool
(/=) :: a -> a -> Bool
x /= y = not (x == y)
Definition above can be read as “class Eq a that has two functions with following signatures and implementations”. In other words, given two a, this function determines are they equal or not (thus Bool as return type). /= is defined in terms of ==, so it’s enough to define one and you get other one for free. But you can still define both if you’re so included (maybe some optimization case).
If we define our own Size type, like below, we can compare sizes:
data Size = Small | Medium | Large
deriving (Show, Read)
instance Eq Size where
Small == Small = True
Medium == Medium = True
Large == Large = True
_ == _ = False
And here’s couple example comparisons.
> Small == Small
> Large /= Large
Writing these by hand is both tedious and error prone, so we usually use automatic derivation for them. Note how the second line now reads deriving (Show, Read, Eq).
data Size = Small | Medium | Large
deriving (Show, Read, Eq)
Hierarchy between type classes
There can be hierarchy between type classes, meaning one requires presence of another. Common example is Ord, which is used to order data.
class Eq a => Ord a where
compare :: a -> a -> Ordering
(<) :: a -> a -> Bool
(>=) :: a -> a -> Bool
(>) :: a -> a -> Bool
(<=) :: a -> a -> Bool
max :: a -> a -> a
min :: a -> a -> a
This definition can be read as “class Ord a, where a has instance of Eq, with pile of functions as follows”. Ord has default implementation for quite many of these, in terms of others, so it’s enough to implement either compare or <=.
For our Size, instance of Ord could be defined as:
instance Ord Size where
Small <= _ = True
Medium <= Small = False
Medium <= _ = True
Large <= Large = True
Large <= _ = False
Writing generic code
There’s lots and lots of type classes in standard library:
Num for numeric operations
Integral for integer numbers
Floating for floating numbers
Show for turning data into strings
Read for turning strings to data
Enum for sequentially ordered types (these can be enumerated)
Bounded for things with upper and lower bound
and so on…
Type classes allow you to write really generic code. Following is contrived example using Ord and Show:
check :: (Ord a, Show a) => a -> a -> String
check a b =
case compare a b of
show a ++ " is smaller than " ++ show b
show a ++ " is greater than " ++ show b
show a ++ " and " ++ show b ++ " are equal"
Check takes two parameters that are same type and that type has to have Ord and Show instances. Ord is for ordering and Show is for turning data into string (handy for displaying it). The end result is string telling result of comparison. Below is some examples of usage. Note how our function can handle different types of data: Size, Int and [Int].
> check Medium Small
"Medium is greater than Small"
> check Small Large
"Small is smaller than Large"
> check 7 3
"7 is greater than 3"
> check [1, 2] [1, 1, 1]
"[1, 2] is greater than [1, 1, 1]"
There are many extensions to type classes that add more behaviour. These aren’t part of standard Haskell, but can be enabled with a pragma definition or compiler flag. They can be somewhat more complicated to use, have special cases that need careful consideration, but offer interesting options.
Thank you for listening. Question, comments and feedback welcome. Best way to catch me nowadays is either by email or in fediverse, where I’m email@example.com.
I use pdmenu a lot to help me do work on my main desktop PC. I did an HPR show on pdmenu on 13 December 2017 and the author Joey Hess responded in show 2459.
In the intervening time I have also integrated Zenity into my menus. This is a GUI tool which generates a number of different pop-up windows known as dialogs, which can display information, or into which information can be typed. The capabilities provided by pdmenu are a little too basic to enable me to do what I need to do.
I thought it might be of interest to show some examples of how I use this tool with pdmenu.
I have provided detailed notes as usual for this episode, and these can be viewed here.
Hosted by Windigo on 2019-08-12 is flagged as Explicit and released under a CC-BY-SA license. Tags:food,cooking.
Listen in ogg, spx, or mp3 format.
This recipe has been heavily adapted from one I received from Hello Fresh - credit where credit's due!
1 lb (500g) Sausage (chicken or pork works)
1 ½ cups (192g) Orzo
2 tbsp (40g) Butter
1 - 2 tbsp (20-40g) Italian Seasoning
2 cups (475ml) water
1 tsp (4g) stock concentrate
16oz (450g?? One normal can, whatever that is) Crushed or diced tomatoes
1 cup (226g) Mozzarella cheese (shredded)
Mince half the shallot (or all of it, I'm not the boss of you). Trim and shred the zucchini. Prepare a mixing bowl lined with a paper towel.
Preheat oven to 500 F
Drizzle some oil into a large oven-proof pan (if you've got one) and cook the sausage, with half the Italian seasoning, over medium heat, breaking it into bite-sized pieces as you cook it. Transfer to the mixing bowl for later.
Add another drizzle of olive oil, and shred the zucchini into the pan. Add shallot, and cook until the zucchini shrinks to ⅔ of its size (about 5 minutes). Transfer to the mixing bowl with the sausage.
Wipe out the pan with a paper towel. Melt 1 tbsp of butter over medium heat, and add orzo, stirring pretty frequently for 2-3 minutes.
Stir in the rest of the Italian seasoning, along with the water, tomatoes, and stock concentrate. Bring to a boil and stir until orzo is done - around 12 - 14 minutes.
Drain excess liquid from the zucchini and sausage.
Mix sausage & zucchini into orzo mixture, with 1 tbsp of butter. Season with salt & pepper, if you want.
If you don't have an oven-proof pan, you're going to want to transfer everything over to a large baking dish of some kind. 13x9" works for me.
Cover the mixture in mozzarella cheese and panko breadcrumbs - in that order!
Place dish in the oven for 2-3 minutes, until the breadcrumbs are toasted.
Note: If these metric measurements seem crazy, they probably are.
I talk about repairing a 1997 handheld cassette recorder and demonstrate its use.
Hosted by Jon Kulp on 2019-08-08 is flagged as Clean and released under a CC-BY-SA license. Tags:Recording, Audio, Tape, Cassette, Recording Devices, Tape Speeds, Electronics, Repair.
Listen in ogg, spx, or mp3 format.
I found a pretty cool little handheld cassette recorder at Salvation Army Thrift Store for 99 cents yesterday. It was non-functioning. I was able to get it working again by 1. cleaning corrosion from battery compartment; 2. replacing the nasty gooey belt; 3. repairing the battery compartment, which had a broken-off spring for one of the battery's negative connections. The most interesting feature of the device is that it has a variable-speed knob for playback at higher speed. I demonstrate this in the podcast.
dodddummy on 2019-07-29:
"I disagree with just about all the opinions expressed in this episode."
dodddummy on 2019-07-29:
"1st hour, that is."
Mailing List discussions
Policy decisions surrounding HPR are taken by the community as a whole. This
discussion takes place on the Mail List which is open to all HPR listeners and
contributors. The discussions are open and available on the HPR server under
The threaded discussions this month can be found here:
This is the LWN.net community event calendar, where we track
events of interest to people using and developing Linux and free software.
Clicking on individual events will take you to the appropriate web
Any other business
Ohio LinuxFest Conference CFP
From Susan Rose, Social Media Manager for OLF:
Dear Open Source Fans, Students and Professionals:
The 2019 Ohio LinuxFest is looking for presentations on Friday and Saturday, November 1 and 2. Please visit the CFP page https://ohiolinux.org/call-for-presentations/ for full details about submitting a proposal. The deadline is Friday, August 17, but the sooner you can submit a talk, the better.
Started in 2003, the Ohio LinuxFest https://ohiolinux.org/ is an annual grassroots conference in Columbus, Ohio dedicated to open access for all. Presentations relating to any free and open source software, not just Linux, are welcome. Areas where we’ve had talks in the past include networking, system administration, development, and community building. A preliminary pdf brochure is attached.
Our audience consists of people at all skill levels. Prior speaking experience is a plus, although we do try to provide opportunities for first-time speakers. If you have any questions, please contact us at firstname.lastname@example.org. We look forward to hearing from you! Thank you for your kind attention and for sharing.
We upload all HPR shows to the Internet Archive (archive.org). Shows downloaded via the HPR RSS feeds actually come from there, though they are also available on the HPR site.
Unfortunately, on Friday July 12th the archive.org copy of the show hpr2855 :: HPR NYE Show 2018-2019 part 6 was found to have been truncated and to consist only of the introduction and final part; no actual content.
The problem was detected during the morning of Friday and was rectified during the afternoon (UK time). The RSS feeds were adjusted to ensure the show was re-downloaded and all podcatchers should have received the correct version the next time they checked the feed.
Tags and Summaries
Thanks to the following contributor for sending in updates in the past month: Dave Morriss
Over the period tags and/or summaries have been added to 11 shows which were without them.
Released: 2019-07-24. Duration: 00:15:55. Flag: Clean. Tags:Application development, Application architecture, Security.
A thought experiment in whether reducing runtime dependencies can improve security and how to do it.
Released: 2019-07-23. Duration: 00:13:50. Flag: Clean. Series:Random Elements of Storytelling. Tags:stories, storytelling, art, commerce, lostnbronx.
Lostnbronx examines stories as both art and products.
Released: 2019-06-27. Duration: 00:31:08. Flag: Clean. Tags:Music,Recording,Audio,Tape,Reel-To-Reel,Open-Reel,Recording Devices,Tape Speeds,Bash Scripting.
I talk about my latest thrift-store gadget, a 1969 Sony portable reel-to-reel tape recorder
Released: 2019-06-24. Duration: 00:31:04. Flag: Clean. Series:How I Found Linux. Tags:linux, intro, story, discourse, bsd.
A response to the request for "how i got into linux" and a little of my history with Linux/BSD
Released: 2019-06-17. Duration: 00:26:16. Flag: Clean. Series:Interviews. Tags:opensource, photography, lubuntu, darktable, rapidphotodownloader, displaycal, gimp.
In this episode, Yannick talks with Wendy Hill about her use of opensource software in her job
Released: 2019-06-13. Duration: 00:29:17. Flag: Clean. Tags:programs, linux, android, apps, applications, lists, favorites.
Moving right along with shows from the requests list, I combine two program lists.
Released: 2019-06-10. Duration: 00:39:07. Flag: Clean. Series:Interviews. Tags:nagios, network, monitoring, opensource, singleboardcomputer, sbc, raspberrypi, odroid.
In this episode, Yannick talks with Robbie Ferguson about the Nagios Enterprise Monitoring System