Yes, I’m not following what @jodak is now attempting. The Haskell community has decided to use .
as postfix/tightfix field accessor, and that’s already implemented in GHC v9, per my links above. It lives alongside .
(non-tightfix) as function composition – rather awkwardly in my opinion.
If you’re asking what I was interested in as o.p., I’m curious why Haskell doesn’t have stand-alone/anonymous records as does SML. It was a question about semantics in the first place, not syntax.
That you can now do (GHC v9), with that dot syntax.
Yeah, not clear what Harper thinks is “unreadable”. The (p:real*real)
is a pair (in Haskell terms) without meaningful names for fst, snd
. I think he’s complaining about positional access and preferring to use named fields – to avoid inadvertently swapping the x, y
coordinates. I think (from the example just after you snip) he’s preferring meaningful field names and/or pattern matching on lhs of a function equation. IOW he’s against any of Haskell’s fst p
or x p
(H98 style) p.fst
or p.x
(OverloadedRecordDot) or p#fst
or p#x
.
Consider a function taking two points as arguments, and calculating the distance between them. Now there’s two x
s and two y
s.