4 ms·
When you say it's not first class, you mean that it can only be inferred?
by jordwalke 12y ago
When you say it's not first class, you mean that it can only be inferred?
- freyrs3 12y agoInference is orthogonal, I mean that a records don't have a distinct type in the type system. So structurally the following types are the same in Haskell, except one elaborates out a selector function. data Foo = Foo { name :: String } data Foo = Foo String What row polymorphism does is give use first-class record types that give us a measure of structural typing so that records with the "same" fields can be used in the same type and "larger" records can inhabit "smaller" types if the fields subsume. So we can write down a function like: foo :: forall r. { a :: Int, b :: Int | r } -> Int foo x = x.a + x.b The current proposal doesn't give us this. But we can still simulate it even if it isn't in the language.