Record type inference for dummies

(haskellforall.com)

75 points | by g0xA52A2A 3 days ago

4 comments

  • PashaGo 14 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
  • vatsachak 22 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

    • wavemode 15 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.

  • antonvs 15 hours ago
    The article missed Go’s anonymous structs:

        p := struct {
            Name string
            Age  int
        }{
            Name: "Alice",
            Age:  30,
        }
  • moozechen 1 hour ago
    [flagged]