3 ms·
Inference 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, excep
by freyrs3 12y ago
Inference 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.