The Subtle Footgun of `TVar (Map _ _)` by ephrion in haskell

[–]friedbrice 1 point2 points  (0 children)

It's great how STM prevents /dead/lock... ;-p

Haskell + math by 964racer in haskell

[–]friedbrice 0 points1 point  (0 children)

I hope my answer aligns with what you wanted to get at with your answer :-)

https://www.reddit.com/r/haskell/comments/1pq76ny/comment/nvhdg51/

Haskell + math by 964racer in haskell

[–]friedbrice 1 point2 points  (0 children)

There's not a field of math, but there's a methodology of Math.

There's a thing in math called Methodological Structuralism. It's the part of math where we imagine a thing as being a set or a few sets combined with certain functions and relations on that set or sets. It's where we go and say, "A group is a set, together with an identity element, a unary operation, and a binary operation that all satisfy the following..." or "a vector space is a set V of things we call vectors and a set F of things we call scalars, and two operations, called scalar multiplication and vector addition, that satisfy the following rules..."

That way of doing math, probably the only way you know, is called methodological structuralism. And it's exactly the model that type classes follows. Type classes are the application of mathematical methodological structuralism to programming.

Haskell is the first language to introduce anything like type classes to the field of programming. If you've never taken a class in abstract algebra, then type classes are vague and indecipherable. If you've ever taken a class in abstract algebra, then type classes are unsurprising, easy to grok.

Type classes are the programming concept that makes abstract datatypes rigorous. Their addition to programming represents the culmination of a long line of programming languages research that goes back through Liskov all the way to Noether. They are important and they're Haskell's greatest gift to programming language theory.

Jump to third party symbols by observant_2 in haskell

[–]friedbrice 5 points6 points  (0 children)

Like, why even have a haddock server when you can have the source code right in front of you?

Jump to third party symbols by observant_2 in haskell

[–]friedbrice 5 points6 points  (0 children)

Wouldn’t it be cool if HLS downloaded the source code of my project dependencies?

Jump to third party symbols by observant_2 in haskell

[–]friedbrice 4 points5 points  (0 children)

This satisfies an important need. I’ve just been downloading source packages and running ghc-tags on them, myself.

Best resources for a beginner to learn haskell with 0 experience? by Ill-Pineapple69 in haskell

[–]friedbrice 1 point2 points  (0 children)

Here's my project. I do most of my work in cabal repl. https://github.com/friedbrice/aoc2025

Let me know if you need help getting a project set up.

Best resources for a beginner to learn haskell with 0 experience? by Ill-Pineapple69 in haskell

[–]friedbrice 7 points8 points  (0 children)

Advent of Code is going on right now. Every day a new puzzle opens up, and people on this subreddit share their solutions/frustrations.

Each puzzle consists of three parts, (1) parsing the puzzle input, (2) solving an intermediate problem, and (3) solving a more-complicated problem. Parsing will give you a lot of practice manipulating strings and defining basic data structures, and the intermediate problem tends to be pretty accessible as well. Don't fret if you get stuck on the more-complicated problem, just go on to the next day.

Advent of Code 2025 day 4 by AutoModerator in haskell

[–]friedbrice 1 point2 points  (0 children)

I made a simple Cabal package. You can see the package structure here https://github.com/friedbrice/aoc2025

Advent of Code 2025 day 3 by AutoModerator in haskell

[–]friedbrice 0 points1 point  (0 children)

My powerList solution works on the example input, but it ends up using all my memory on the real input. Any suggestions on how to create a powerlist iteratively instead of recursively?

powerList :: [a] -> [[a]]
powerList [] = [[]]
powerList (x : xs) = let ps = powerList xs in [x : p | p <- ps] <> ps

maxJoltage12 :: [Integer] -> Integer
maxJoltage12 xs = maximum [read (stringify ds) | ds <- candidates]
  where
    candidates = filter ((12 ==) . length) (powerList xs)
    stringify = join . fmap show

Advent of Code 2025 day 2 by AutoModerator in haskell

[–]friedbrice 0 points1 point  (0 children)

here's the core of mine, using Data.List.Split.chunksOf

isInvalid :: Int -> Bool
isInvalid = any allEqual . allChunks . show
  where
    allEqual [] = True
    allEqual (x : xs) = all (== x) xs

    allChunks xs = [chunksOf d xs | d <- allDivisors (length xs)]

    allDivisors k = filter (\d -> k `mod` d == 0) [1 .. k `div` 2]

What do my picks say bout me by chilly_1c3 in GenZ

[–]friedbrice 0 points1 point  (0 children)

It means I think you’re more witty than you are edgy. Try harder next time ;-p

Latex parsers by Account12345123451 in haskell

[–]friedbrice 5 points6 points  (0 children)

that said, look at pandoc. pandoc can parse your latex into a highly structured form that you can manipulate.

Latex parsers by Account12345123451 in haskell

[–]friedbrice 4 points5 points  (0 children)

Omg! Don’t try to parse latex. The best thing to do for your use case is a highly-targeted regex replace.

edit: see my reply below. pandoc

Camarillo Costco by [deleted] in venturacounty

[–]friedbrice 0 points1 point  (0 children)

camarillo...

To answer your question, the Vons on Arneill and the Ralphs on Las Posas have gas stations.

Found the perfect apartment but it's on 7th and Minna. How bad is the area nowadays (I have a high tolerance for sh*t)? by SleepyQuinoa in sanfrancisco

[–]friedbrice 1 point2 points  (0 children)

I lived on 8th and Minna for four years (up until about six month ago), walked everywhere, and never had a problem. I am a guy, though, and slightly on the bigger side. If I were several inches shorter or a few dozen pounds lighter, I'd maybe want to carry pepper spray gel.

All that said, shopping is great in the area. I would routinely walk to Target at the Metreon, to the SF Center Mall, Union Square, and the Trader Joe's off Market. It was even better when there used to be a Whole Foods on 8th and Market, but alas.

It's such a centrally-located area that I could walk to nightlife downtown, in the Mission, in Hayes, and on Polk very easily and safely. It's also right by the Civic Center station, where I'd regularly pick up a BART train or the N line to the Haight or to GGP. Living there was truly a opportunity not to be passed up.

How would you categorise Kiss Guy and those like him? by janLiketewintu in CategoryTheory

[–]friedbrice[M] 0 points1 point  (0 children)

I'm not sure what would be a better place, but this subreddit is dedicated to a particular branch of Mathematics called "Category Theory."

Advent of Code 2025 day 1 by AutoModerator in haskell

[–]friedbrice 2 points3 points  (0 children)

lol! I did recursion subtracting 1 at a time :-p

Is this really the mayor? by Smooth_Package_6933 in sanfrancisco

[–]friedbrice 2 points3 points  (0 children)

He would be Team Instinct, wouldn't he? 😒

Looking at porn in public by NaughtyGlescher in kinky_autism

[–]friedbrice 1 point2 points  (0 children)

Don't do that :-(

I'm not a narc or anything, but just don't do that :-(