Hacker News

g0xA52A2A
Record type inference for dummies haskellforall.com

PashaGo5 hours ago

Anonymous records feel like one of those features that are obviously useful once you work with JSON-heavy systems, but surprisingly uncommon in statically typed languages

vatsachak12 hours ago

An anonymous record type in a language whose type system is an enum LangType in Rust is just HashMap<String, Box<LangType>>

My pet project requires an STLC with anonymous record types and type inference for anonymous records wasn't too bad

wavemode5 hours ago

Anonymous records aren't complex in principle. The main challenge Haskell has always faced in this area, is the simple fact that its type system (and syntax) weren't designed for anonymous records from the start, so they have to be shoehorned in without breaking existing semantics.

PureScript has much better support for row polymorphism for this reason.

[deleted]5 hours agocollapsed

antonvs5 hours ago

The article missed Go’s anonymous structs:

    p := struct {
        Name string
        Age  int
    }{
        Name: "Alice",
        Age:  30,
    }
hn-front (c) 2024 voximity
source