3 ms·
From the talks I've seen Gundry usually tends to qualify comments about OverloadedRecordFields by saying it's not traditional row polymorphism ( i.e. Record { n
by freyrs3 12y ago
From the talks I've seen Gundry usually tends to qualify comments about OverloadedRecordFields by saying it's not traditional row polymorphism ( i.e. Record { name :: String | r }) ). It doesn't allow row extension or row restriction as first-class constructs in the type system. Although we can build these things as secondary features on top of the language as many libraries currently do though.
- jordwalke 12y agoWhen 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.