Hacker News new | ask | show | jobs
by mthq 4394 days ago
Row types are a way to encode type information of OOP object in a hindley milner type system. It allows you to type check the kind of ducked objects that are often featured in dynamic OOP languages like ruby and javascript. So you may specify a function on a object containing specific fields or methods without specifying a concrete type:

  f :: {left: Number, right: Number} -> Number
  f object = object.a + object.b
All type checked of course.

See here for more info: https://www.cs.cmu.edu/~neelk/rows.pdf

1 comments

I assume you meant to write `object.left + object.right` instead of `a` and `b`, to match the type signature.