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

2006-01-06 Thread Joel Reymont
How does pattern matching work with HList? I would like to pass a HList to a function and only match if a certain field had a certain value. On Jan 6, 2006, at 7:14 AM, [EMAIL PROTECTED] wrote: *Test :t accessor accessor :: (HasField l r v) = r - l - v --

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

2006-01-06 Thread oleg
Joel Reymont wrote: How does pattern matching work with HList? I would like to pass a HList to a function and only match if a certain field had a certain value. The code below defines the function foo that accepts a record and yields one value if the field PtX of the record has the value 0.

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

2006-01-05 Thread Stefan Monnier
This change solves the problem that different records in a single namespace cannot share field names in a simple manner. As mentioned elsewhere, you'd also need to remove the functional update feature to fix this namespace problem. In order to allow the writing of records code with is both

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

2006-01-05 Thread oleg
David Roundy wrote: The only solution I can imagine would be to implement a class for each field name. i.e. the only reasonble type of f I can imagine is something like f :: Integral i, RecordHasField_foo i r = r - r But that's a very complicated solution, and once one implemented that

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

2006-01-04 Thread Ulf Norell
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 }

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

2006-01-04 Thread David Roundy
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)

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

2006-01-04 Thread John Goerzen
On 2006-01-02, David Roundy [EMAIL PROTECTED] wrote: My proposal is simply to remove the automatic declaration of accessor functions. In Haskell 98, data FooBar = Foo { foo :: Int } | FooBar = { foo :: Int, bar :: Int } I would find this to be incredibly annoying. The fact that these

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

2006-01-04 Thread David Roundy
On Wed, Jan 04, 2006 at 02:17:27PM +, John Goerzen wrote: On 2006-01-02, David Roundy [EMAIL PROTECTED] wrote: My proposal is simply to remove the automatic declaration of accessor functions. In Haskell 98, data FooBar = Foo { foo :: Int } | FooBar = { foo :: Int, bar :: Int } I

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

2006-01-04 Thread John Goerzen
On 2006-01-04, David Roundy [EMAIL PROTECTED] wrote: On Wed, Jan 04, 2006 at 02:17:27PM +, John Goerzen wrote: Haskell 98 already requires you to code up set* functions (provided you want them), so I'd only be doubling the amount of work you need to do. If you can get by with the existing

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

2006-01-04 Thread Iavor Diatchki
Hello, On 1/4/06, David Roundy [EMAIL PROTECTED] wrote: 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

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

2006-01-04 Thread John Meacham
On Wed, Jan 04, 2006 at 08:55:39AM -0500, David Roundy wrote: 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 foos in a given data type have the same type. Which I don't think is a bad thing

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

2006-01-03 Thread Ashley Yakeley
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

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

2006-01-03 Thread Dylan Thurston
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,

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

2006-01-02 Thread Ashley Yakeley
In article [EMAIL PROTECTED], David Roundy [EMAIL PROTECTED] 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 =