this post was submitted on 22 Oct 2025
846 points (98.2% liked)

Programmer Humor

27048 readers
374 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[–] tiramichu@sh.itjust.works 60 points 2 days ago* (last edited 2 days ago) (1 children)

No mom, I'm gonna BE a girl for Christmas. puts on programming socks

[–] Quibblekrust@thelemmy.club 3 points 1 day ago

That's 100% how I read it at first.

[–] biggeoff@sh.itjust.works 4 points 1 day ago

Based Tsoding

[–] umbraroze@slrpnk.net 12 points 2 days ago (1 children)

I'm a girl. I'm not interested in Haskell, that's too frigging endofunctiorific. Erlang! That's what all the cool guys are doing.

[–] ICastFist@programming.dev 4 points 1 day ago

What about going an extra step into Elixir?

[–] jerkface@lemmy.ca 23 points 2 days ago

I don't think "programmer" fully captures the reality of being an emacs-based programmer.

[–] Cevilia@lemmy.blahaj.zone 36 points 2 days ago (1 children)

This kind of text hits differently when you're a lesbian.

[–] ILikeBoobies@lemmy.ca 14 points 2 days ago* (last edited 2 days ago) (1 children)

Wouldn’t it hit the same as it would a straight male?

[–] buddascrayon@lemmy.world 15 points 2 days ago

POV: Not all moms are accepting of their daughters being into girls.

[–] bestelbus22@lemmy.world 9 points 2 days ago

Hello everyone, and welcome to yet another recreational programming session with who?

[–] magic_smoke@lemmy.blahaj.zone 83 points 3 days ago (2 children)

Jokes on her, I've transitioned since last Christmas.

[–] Fisherswamp@programming.dev 82 points 3 days ago

You can still bring a girl though

[–] chellomere@lemmy.world 62 points 3 days ago (1 children)

I am the girl! Hmm, but maybe I'll bring another one too? 🤔

[–] bhamlin@lemmy.world 14 points 3 days ago (3 children)
load more comments (3 replies)
[–] balsoft@lemmy.ml 100 points 3 days ago (6 children)

You gotta admit though, Haskell is crazy good for parsing and marshaling data

[–] marcos@lemmy.world 41 points 3 days ago (6 children)

Yes. I'm divided into "hum... 100 lines is larger than I expected" and "what did he mean 'from scratch'? did he write the parser combinators? if so, 100 lines is crazy small!"

But I'm settling in believing 80 of those lines are verbose type declarations.

[–] balsoft@lemmy.ml 16 points 2 days ago* (last edited 1 day ago) (1 children)

I decided to write it myself for fun. I decided that "From Scratch" means:

  • No parser libraries (parsec/happy/etc)
  • No using read from Prelude
  • No hacky meta-parsing

Here is what I came up with (using my favourite parsing method: parser combinators):

import Control.Monad ((>=>), replicateM)
import Control.Applicative (Alternative (..), asum, optional)
import Data.Maybe (fromMaybe)
import Data.Functor (($>))
import Data.List (singleton)
import Data.Map (Map, fromList)
import Data.Bifunctor (first, second)
import Data.Char (toLower, chr)

newtype Parser i o = Parser { parse :: i -> Maybe (i, o) } deriving (Functor)

instance Applicative (Parser i) where
  pure a = Parser $ \i -> Just (i, a)
  a <*> b = Parser $ parse a >=> \(i, f) -> second f <$> parse b i
instance Alternative (Parser i) where
  empty = Parser $ const Nothing
  a <|> b = Parser $ \i -> parse a i <|> parse b i
instance Monad (Parser i) where
  a >>= f = Parser $ parse a >=> \(i, b) -> parse (f b) i
instance Semigroup o => Semigroup (Parser i o) where
  a <> b = (<>) <$> a <*> b
instance Monoid o => Monoid (Parser i o) where
  mempty = pure mempty

type SParser = Parser String

charIf :: (a -> Bool) -> Parser [a] a
charIf cond = Parser $ \i -> case i of
  (x:xs) | cond x -> Just (xs, x)
  _ -> Nothing

char :: Eq a => a -> Parser [a] a
char c = charIf (== c)

one :: Parser i a -> Parser i [a]
one = fmap singleton

str :: Eq a => [a] -> Parser [a] [a]
str = mapM char

sepBy :: Parser i a -> Parser i b -> Parser i [a]
sepBy a b = (one a <> many (b *> a)) <|> mempty

data Decimal = Decimal { mantissa :: Integer, exponent :: Int } deriving Show

data JSON = Object (Map String JSON) | Array [JSON] | Bool Bool | Number Decimal | String String | Null deriving Show

whitespace :: SParser String
whitespace = many $ asum $ map char [' ', '\t', '\r', '\n']

digit :: Int -> SParser Int
digit base = asum $ take base [asum [char c, char (toLower c)] $> n | (c, n) <- zip (['0'..'9'] <> ['A'..'Z']) [0..]]

collectDigits :: Int -> [Int] -> Integer
collectDigits base = foldl (\acc x -> acc * fromIntegral base + fromIntegral x) 0

unsignedInteger :: SParser Integer
unsignedInteger = collectDigits 10 <$> some (digit 10)

integer :: SParser Integer
integer = asum [char '-' $> (-1), char '+' $> 1, str "" $> 1] >>= \sign -> (sign *) <$> unsignedInteger

-- This is the ceil of the log10 and also very inefficient
log10 :: Integer -> Int
log10 n
  | n < 1 = 0
  | otherwise = 1 + log10 (n `div` 10)

jsonNumber :: SParser Decimal
jsonNumber = do
  whole <- integer
  fraction <- fromMaybe 0 <$> optional (str "." *> unsignedInteger)
  e <- fromIntegral . fromMaybe 0 <$> optional ((str "E" <|> str "e") *> integer)
  pure $ Decimal (whole * 10^log10 fraction + signum whole * fraction) (e - log10 fraction)

escapeChar :: SParser Char
escapeChar = char '\\'
  *> asum [
    str "'" $> '\'',
    str "\"" $> '"',
    str "\\" $> '\\',
    str "n" $> '\n',
    str "r" $> '\r',
    str "t" $> '\t',
    str "b" $> '\b',
    str "f" $> '\f',
    str "u" *> (chr . fromIntegral . collectDigits 16 <$> replicateM 4 (digit 16))
  ]

jsonString :: SParser String
jsonString =
  char '"'
  *> many (asum [charIf (\c -> c /= '"' && c /= '\\'), escapeChar])
  <* char '"'

jsonObjectPair :: SParser (String, JSON)
jsonObjectPair = (,) <$> (whitespace *> jsonString <* whitespace <* char ':') <*> json

json :: SParser JSON
json =
  whitespace *>
    asum [
      Object <$> fromList <$> (char '{' *> jsonObjectPair `sepBy` char ',' <* char '}'),
      Array <$> (char '[' *> json `sepBy` char ',' <* char ']'),
      Bool <$> asum [str "true" $> True, str "false" $> False],
      Number <$> jsonNumber,
      String <$> jsonString,
      Null <$ str "null"
    ]
    <* whitespace

main :: IO ()
main = interact $ show . parse json

This parses numbers as my own weird Decimal type, in order to preserve all information (converting to Double is lossy). I didn't bother implementing any methods on the Decimal, because there are other libraries that do that and we're just writing a parser.

It's also slow as hell but hey, that's naive implementations for you!

It ended up being 113 lines. I think I could reduce it a bit more if I was willing to sacrifice readability and/or just inline things instead of implementing stdlib typeclasses.

[–] jerkface@lemmy.ca 5 points 2 days ago (1 children)

So, ARE you bringing a girl?

[–] balsoft@lemmy.ml 14 points 2 days ago* (last edited 2 days ago) (2 children)

I'm not coming to my parents for this new year's because I might get arrested and/or sent to die in a war. But once Putin dies, yes, I am

[–] jerkface@lemmy.ca 4 points 2 days ago

So that's two things to look forward to!

Didn't know where you were talking about til you said Putin.

load more comments (5 replies)
load more comments (5 replies)
[–] CanadaPlus@lemmy.sdf.org 78 points 3 days ago (1 children)

Who needs a girl when you have monads to keep you warm?

[–] boonhet@sopuli.xyz 18 points 3 days ago

Or become a girl with gonads

[–] lemmydividebyzero@reddthat.com 36 points 3 days ago (5 children)

There are far more male programmers... As a programmer, be gay or stay alone... Choose!

[–] psud@aussie.zone 3 points 1 day ago

It's odd in the Australian public service, with COBOL programmers. They've been in the job long enough that they started when the public service was the only employer who would employ women as programmers. I'm on the systems analyst side of the fence, the programmers I have worked with include a bit more than 60% women

I think all the programmers I know are married or gay or not interested. I think the gay ones are mostly married too.

[–] undefined@lemmy.hogru.ch 24 points 2 days ago (3 children)

Can programmers only be with other programmers or am I missing something?

[–] fibojoly@sh.itjust.works 1 points 1 day ago

Well yeah, obv. But not enough girls in computer science, so like the fishes, some of them magically turn into girls after a while.

[–] davidagain@lemmy.world 22 points 2 days ago (1 children)

"JSON parser 100% from scratch in Haskell in 110 lines" doesn't get you horny? I guess some people are just wired differently.

[–] undefined@lemmy.hogru.ch 4 points 2 days ago (2 children)

I’m a programmer myself but my wife isn’t a programmer, that was my motivation for questioning.

[–] davidagain@lemmy.world 5 points 2 days ago

Don't worry. I mean nothing but humour by it. I myself am married to a physicist who takes absolutely no interest whatsoever in programming, but can talk happily for ages about something weird they found.

Oh, is she, like, an EE or something? Maybe a web designer?

[–] lemmydividebyzero@reddthat.com 11 points 2 days ago

But you kind of have to leave the house for that... I mean... We talk about programmers....

/s

[–] captainlezbian@lemmy.world 29 points 3 days ago (6 children)

Oh that explains why my wife is gay

[–] mathemachristian@lemmy.blahaj.zone 11 points 2 days ago (1 children)

If she was around the same cs students as me then yeah

load more comments (1 replies)
load more comments (5 replies)
[–] ZILtoid1991@lemmy.world 17 points 3 days ago (2 children)

There are those who transition, so a significant chunk of that male programmer population is "male" as in quotation marks, only that some transition earlier than others. Does not guarantee that you can get the transgender autistic puppygirl (or other variations) of your dreams, since many of them are lesbians.

But also feel free to look outside your field for a partner. It's okay to date an artist as a programmer.

[–] andioop@programming.dev 1 points 7 hours ago* (last edited 7 hours ago)

Feels weird reading this as the only single woman programmer in my friend group who likes men

[–] rucksack@feddit.org 8 points 2 days ago (2 children)

I think programmer should be seen as a gender itself.

I'm currently transitioning myself, already have a homeserver and a Linux PC, can't wait to be a real programmer.

[–] shoki@lemmy.world 6 points 2 days ago (1 children)

and gender confirmation would not be getting called sir/ma'am at the starbucks but people asking you for IT help?

Just slurs, shouted angrily and incoherently whike they blame you for all the shit that was designed (by someone else) to not work.

[–] lessthanluigi@lemmy.sdf.org 8 points 2 days ago

I detransitioned from being a programmer and all I have is depression since, maybe I should retransission into being a programmer

load more comments (1 replies)
[–] mudkip@lemdro.id 4 points 2 days ago

Well, JSON is an easy format to parse. The spec can fit onto one page.

[–] yetAnotherUser@lemmy.ca 39 points 3 days ago (2 children)

You just need to find a girl that also likes Tsoding! Then, you can ask her "Hey, do you have plans for Christmas? I'd love it if we could do AoC (Advent of Code) in a language we both hate!"

load more comments (2 replies)
[–] RedSnt@feddit.dk 28 points 3 days ago (7 children)
load more comments (7 replies)
[–] Kolanaki@pawb.social 10 points 2 days ago* (last edited 2 days ago)

He won't be done debugging her by then. She'll be ready for beta testing next year.

load more comments
view more: next ›