[GHC] #2595: Implement record update for existential and GADT data
types
GHC
trac at galois.com
Mon Sep 15 10:00:46 EDT 2008
#2595: Implement record update for existential and GADT data types
--------------------------------+-------------------------------------------
Reporter: simonpj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler | Version: 6.8.3
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Architecture: Unknown | Os: Unknown
--------------------------------+-------------------------------------------
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2595>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list