Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Implement record update for existential and GADT data types
Ganesh writes: The most important thing for me is supporting record update for existentially quantified data records, as in the error below. In general I also find working with code that involves existential type variables quite hard work - for example I can't use foo as a record selector either, even if I immediately do something that seals the existential type back up again. I don't understand this stuff well enough to be sure whether it's an impredicativity issue or not, though. ``` Foo.hs:11:8: Record update for the non-Haskell-98 data type `Foo' is not (yet) supported Use pattern-matching instead In the expression: rec {foo = id} In the definition of `f': f rec = rec {foo = id} ``` Program is: ``` {-# LANGUAGE Rank2Types #-} module Foo where data Foo = forall a . Foo { foo :: a -> a, bar :: Int } x :: Foo x = Foo { foo = id, bar = 3 } f :: Foo -> Foo f rec = rec { foo = id } g :: Foo -> Foo g rec = rec { bar = 3 } ``` Simon says: Ah now I see. The relevant comment, `TcExpr` line 465, says ``` -- Doing record updates on -- GADTs and/or existentials is more than my tiny -- brain can cope with today ``` Should be fixable, even with a tiny brain. <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | -------------- | | Version | 6.8.3 | | Type | FeatureRequest | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Compiler | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | Unknown | | Architecture | Unknown | </details> <!-- {"blocked_by":[],"summary":"Implement record update for existential and GADT data types","status":"New","operating_system":"Unknown","component":"Compiler","related":[],"milestone":"6.12 branch","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.8.3","keywords":[],"differentials":[],"test_case":"","architecture":"Unknown","cc":[""],"type":"FeatureRequest","description":"Ganesh writes: The most important thing for me is supporting record update for\r\nexistentially quantified data records, as in the error below.\r\n\r\nIn general I also find working with code that involves existential\r\ntype variables quite hard work - for example I can't use foo as a\r\nrecord selector either, even if I immediately do something that seals\r\nthe existential type back up again.\r\n\r\nI don't understand this stuff well enough to be sure whether it's an\r\nimpredicativity issue or not, though.\r\n\r\n{{{\r\nFoo.hs:11:8:\r\n Record update for the non-Haskell-98 data type `Foo' is not (yet)\r\nsupported\r\n Use pattern-matching instead\r\n In the expression: rec {foo = id}\r\n In the definition of `f': f rec = rec {foo = id}\r\n}}}\r\nProgram is:\r\n{{{\r\n{-# LANGUAGE Rank2Types #-}\r\nmodule Foo where\r\n\r\ndata Foo = forall a . Foo { foo :: a -> a, bar :: Int }\r\n\r\nx :: Foo\r\nx = Foo { foo = id, bar = 3 }\r\n\r\nf :: Foo -> Foo\r\nf rec = rec { foo = id }\r\n\r\ng :: Foo -> Foo\r\ng rec = rec { bar = 3 }\r\n}}}\r\n\r\nSimon says: Ah now I see. The relevant comment, `TcExpr` line 465, says\r\n{{{\r\n-- Doing record updates on\r\n-- GADTs and/or existentials is more than my tiny \r\n-- brain can cope with today\r\n}}}\r\nShould be fixable, even with a tiny brain.\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->
issue