1423
Golang be like (i.imgur.com)
you are viewing a single comment's thread
view the rest of the comments
[-] barsoap@lemm.ee 1 points 1 year ago* (last edited 1 year ago)

I was thinking along the lines of "you can't easily get at the wrapped type". To get at b instead of Maybe b you need to either use do-notation or lambdas (which do-notation is supposed to eliminate because they're awkward in a monadic context) whereas Rust will gladly hand you that b in the middle of an expression, and doesn't force you to name the point.

Or to give a concrete example, if foo()? {...} is rather awkward in Haskell, you end up writing things like

foo x y = bar >>= baz x y
  where
    baz x y True = x
    baz x y False = y

, though of course baz is completely generic and can be factored out. I think I called it "cap" in my Haskell days, for "consequent-alternative-predicate".

Flattening Functors and Monads syntax-wise is neat but it's not getting you all the way. But it's the Haskell way: Instead of macros, use tons upon tons of trivial functions :)

this post was submitted on 14 Aug 2023
1423 points (98.0% liked)

Programmer Humor

19178 readers
980 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 1 year ago
MODERATORS