[Haskell] Re: (small) records proposal for Haskell '06

David Roundy droundy at abridgegame.org
Wed Jan 4 08:55:39 EST 2006


On Wed, Jan 04, 2006 at 11:53:59AM +0100, Ulf Norell wrote:
> 
> On Jan 4, 2006, at 2:25 AM, Dylan Thurston wrote:
> 
> >On Tue, Jan 03, 2006 at 02:41:40PM -0800, Ashley Yakeley wrote:
> >>David Roundy wrote:
> >>>On Mon, Jan 02, 2006 at 04:23:32PM -0800, Ashley Yakeley wrote:
> >>>>>One open question (in my mind) would be whether we'd allow
> >>>>>
> >>>>>data Foo = FooInt { foo :: Int } | FooChar { foo :: Char }
> >>>>>
> >>>>>In the "new" system, there's no reason this need be illegal.
> >>>>How would this behave?
> >>>>
> >>>>data Foo a b = FooA {foo :: a} | FooB {foo :: b}
> >>>I'm not sure I understand the problem.  Why would there be any  
> >>>difficulty
> >>>with this?
> >>What type would "foo" have? ...
> >
> >Nothing, since in David's proposal there would be no 'foo' defined on
> >the top level at all.
> 
> What happens to record updates?
> 
> setFoo x r = r { foo = x }
> 
> Or is the proposal to remove updates as well?

Ah, good point, I hadn't thought about that.  My proposal was to keep
record updates which would indeed mean that we'd need to require that all
"foo"s in a given data type have the same type.  Which I don't think is a
bad thing either... it just hadn't occurred to me.
-- 
David Roundy
http://www.darcs.net


More information about the Haskell mailing list