Re: [Haskell] Records in Haskell

2011-11-07 Thread Barney Hilken
ty (except for undefined), in the second case inhabited by a single element (Label :: Label "name") There are several similar proposals for extensible records defined using labels, all of which (as far as I can see) could be defined just as easily using the kind String. There is

[Haskell] ANN: has-0.4 Entity based records

2010-05-04 Thread HASHIMOTO, Yusaku
Hello, I'm pleased to announce the release of my new library, named "has", written to aim to ease pain at inconvinience of Haskell's build-in records. With the has, You can reuse accessors over records to write generic function, combine records with another. Repositor

Re: [Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-22 Thread Barney Hilken
While I agree with your general argument, I wonder if you realize that functional dependencies have a strong, general, and elegant mathematical foundation that long predates their use in Haskell? If you want even a brief glimpse, there's s short article at http://en.wikipedia.org/wiki/Functional_

Re: [Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-21 Thread Mark P Jones
Barney Hilken wrote: I totally disagree. The great strength of Haskell is that, whenever important design decisions have been made, the primary consideration has not been practicality, but generality and mathematical foundation. When the Haskell committee first started work, many people said la

Re: [Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-21 Thread Andrzej Jaworski
Johannes Waldmann <[EMAIL PROTECTED]> has asked me to clarify my claims here. But I say: why not to ask Chris Okasaki himself? Manuel Chakravarty has recently published this: http://www.cse.unsw.edu.au/~chak/papers/WC07.html so he might take the question too. >From my perspective there are too m

[Haskell] Re: Re: Re: RE: Extensible records: Static duck typing

2008-02-21 Thread Ben Franksen
Barney Hilken wrote: >> My rationale for these criteria goes like this: efficient access is >> necessary if we want to compete with the much simpler record systems >> in >> mainstream languages. If records are not as light-weight >> (syntactically as >> well as

Re: [Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-21 Thread Andrzej Jaworski
Dear Fellows, It is obvious that Haskell takes its strength from well implemented abstract concepts that made monadic programming natural and threads cheap. However I believe that some top decisions have been made in the wrong order, which is extremely important now to be aware of when new featu

Re: [Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-21 Thread Barney Hilken
My rationale for these criteria goes like this: efficient access is necessary if we want to compete with the much simpler record systems in mainstream languages. If records are not as light-weight (syntactically as well as wrt run-time performance) as 'normal' Haskell data types, t

[Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-20 Thread Ben Franksen
>> can I read more about them? >> >> Hlist is one of the ones | was thinking of. Two more are "poor man's >> records" a.k.a. Data.Record.hs, whose author certainly believes it >> should be the basis for the new system, and my own system, >> download

[Haskell] Re: Re: RE: Extensible records: Static duck typing

2008-02-20 Thread Ben Franksen
t is one of the ones | was thinking of. Two more are "poor man's > records" a.k.a. Data.Record.hs, whose author certainly believes it > should be the basis for the new system, and my own system, > downloadable from http://homepage.ntlworld.com/b.hilken/files/Records.hs &g

Re: [Haskell] Re: RE: Extensible records: Static duck typing

2008-02-18 Thread Barney Hilken
"poor man's records" a.k.a. Data.Record.hs, whose author certainly believes it should be the basis for the new system, and my own system, downloadable from http://homepage.ntlworld.com/b.hilken/files/Records.hs There is a discussion of the various possibili

[Haskell] Re: RE: Extensible records: Static duck typing

2008-02-18 Thread Ben Franksen
[I replied on @cafe but didn't get any response. Trying again here.] Barney Hilken wrote: >> What about just implementing the cheapest solution that still gets >> us most >> of the way? > >> (3) If it is as cheap (to implement) as advertised then there is no >> great >> risk involved. If it turns

Re: [Haskell] Extensible records: Static duck typing

2008-02-10 Thread Jason Dusek
> > 'x point Say we go with 'x and allow it to pick the x field out of records. All records. Then we have implicitly defined a function 'x that accepts things in the HasAnX class. This class is also implicitly defined -- and things are added to it implicitly, too, by giving them an

Re: [Haskell] Extensible records: Static duck typing

2008-02-10 Thread Jason Dusek
blue, >getValue := getEntryValue, >setValue := setEntryValue} > > e.display -- uses color/label properties > e.saveToFile -- uses getValue property I'm new to all this -- I can't figure out why we want to put methods inside of records. W

Re: [Haskell] RE: Extensible records: Static duck typing

2008-02-10 Thread Barney Hilken
What about just implementing the cheapest solution that still gets us most of the way? (3) If it is as cheap (to implement) as advertised then there is no great risk involved. If it turns out the missing features are a great show-stopper for some people (which I don't believe) then let them

[Haskell] RE: Extensible records: Static duck typing

2008-02-09 Thread Ben Franksen
Simon Peyton-Jones wrote: > Since you are taking my name in vain, I had better respond! I wish I felt > as confident of my good taste as you do. My last attempt to implement > records (with Umut Acar, more or less the design in the "proposal for > records" paper) invol

Re: [Haskell] Extensible records: Static duck typing

2008-02-08 Thread Brandon S. Allbery KF8NH
[hm. should this discussion move to -cafe?] On Feb 8, 2008, at 20:15 , Jonathan Cast wrote: On 8 Feb 2008, at 4:43 PM, Dan Weston wrote: Ouch. How would a human parse [apple'*'pear] In this context, `parse error, tricky syntax'. I kinda have that problem anyway given ' being permitted in

Re: [Haskell] Extensible records: Static duck typing

2008-02-08 Thread John Meacham
On Fri, Feb 08, 2008 at 04:43:43PM -0800, Dan Weston wrote: > Ouch. How would a human parse [apple'*'pear] > > If this doesn't immediately scan as [ (*') (apple') (pear) ] to you (it > doesn't to me) then maybe allowing ' in infix operators may not be the best > thing. Oh, I was thinking they wo

Re: [Haskell] Extensible records: Static duck typing

2008-02-08 Thread Jonathan Cast
On 8 Feb 2008, at 4:43 PM, Dan Weston wrote: Ouch. How would a human parse [apple'*'pear] In this context, `parse error, tricky syntax'. In general? Not as sure. jcc ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/list

Re: [Haskell] Extensible records: Static duck typing

2008-02-08 Thread Dan Weston
Ouch. How would a human parse [apple'*'pear] If this doesn't immediately scan as [ (*') (apple') (pear) ] to you (it doesn't to me) then maybe allowing ' in infix operators may not be the best thing. John Meacham wrote: On Tue, Feb 05, 2008 at 08:01:07AM -0500, Cale Gibbard wrote: I also li

Re: [Haskell] Extensible records: Static duck typing

2008-02-08 Thread John Meacham
On Tue, Feb 05, 2008 at 08:01:07AM -0500, Cale Gibbard wrote: > I also like this idea. Retaining the ability to treat selection as a > function easily is quite important, and this meets that criterion > nicely. Also, in which case does this cause a program to break? It > seems that you're only rein

Re: [Haskell] Extensible records: Static duck typing

2008-02-06 Thread Barney Hilken
2. List the possible features that “records” might mean. For example: · Anonymous records as a type. So {x::Int, y::Bool} is a type. (In Haskell as it stands, records are always associated with a named data type. · Polymorphic field access. r.x accesses a field in any

Re: [Haskell] Extensible records: Static duck typing

2008-02-06 Thread Sebastian Sylvan
On Feb 6, 2008 12:19 PM, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: >So to clarify that statement. Honestly the number one problem I have > with the current records system is that labels share the same namespace. > This makes interfacing with any C library using structs quit

RE: [Haskell] Extensible records: Static duck typing

2008-02-06 Thread Simon Peyton-Jones
So to clarify that statement. Honestly the number one problem I have with the current records system is that labels share the same namespace. This makes interfacing with any C library using structs quite painful. This is why I say that I don't really care which gets implemented. The cu

Re: [Haskell] Extensible records: Static duck typing

2008-02-06 Thread Sebastian Sylvan
ry good) proposals get > implemented, but I do have a strong opinion that the lack of "proper" > records is hurting Haskell quite a bit. > > > > Any of them will do, just get it in there! I'm assuming that Simon {PJ,M} > et al. won't make an obviously terrible

RE: [Haskell] Extensible records: Static duck typing

2008-02-06 Thread Simon Peyton-Jones
ndard by default. This is the sort of situation where a "benign dictator" is needed. I have no strong feelings about which of all of these (all very good) proposals get implemented, but I do have a strong opinion that the lack of "proper" records is hurting Haskell quite a

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Barney Hilken
hesis. One of the advantages of the systems with richer polymorphism and more predicates is that they need less syntax. It is possible (once you have solved the permutation/scoping problem) to use constructors as labels, and define all the basic operators on records as standard Haskell func

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, John Meacham <[EMAIL PROTECTED]> wrote: > choice 2: use ', declare that any identifier that _begins_ with ' always > refers to a label selection function > > 'x point > > (snip) > > none are fully backwards compatible. I am still not sure which I like > the best, ' has a lot of appe

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread John Meacham
blatant type error, and that (.) there doesn't mean function > composition. :) > > On the matter of extensible records, I really like the semantics of > Daan Leijen's proposal here: > http://research.microsoft.com/users/daan/download/papers/scopedlabels.pdf > > How

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Sebastian Sylvan
nted, but I do have a strong opinion that the lack of "proper" records is hurting Haskell quite a bit. Any of them will do, just get it in there! I'm assuming that Simon {PJ,M} et al. won't make an obviously terrible choice, and GHC seems to be the de facto standard anyway, so if

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Johannes Waldmann
> Everyone wants to add extensible records to Haskell. well ... sure records are better than tuples ... but interfaces (uh, classes) are still better IMHO but anyway, is it possible to steal the design of C#'s anonymous types (classes)? if not, then why? (this might help to clarify

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Barney Hilken
The scoped labels paper has an interesting feature in this regard: labels with different names can be swapped at will, but labels having the same name (which is allowed) maintain their order. - Cale Yes, I know. The problem is that there are TOO MANY proposals, and they are all fundamental

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Cale Gibbard <[EMAIL PROTECTED]> wrote: > On 05/02/2008, Barney Hilken <[EMAIL PROTECTED]> wrote: > > > > Should {label := "Hi", color := blue} and {color := blue, label := > > "Hi"} have the same type? > > > > The scoped labels paper has an interesting feature in this regard

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Barney Hilken <[EMAIL PROTECTED]> wrote: > > Should {label := "Hi", color := blue} and {color := blue, label := > "Hi"} have the same type? > The scoped labels paper has an interesting feature in this regard: labels with different names can be swapped at will, but labels hav

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Barney Hilken
Everyone wants to add extensible records to Haskell. The problem is that, in a formally defined language like Haskell, we need to agree how they should behave, and there are too many conflicting ideas. I was involved recently in an attempt to try to sort out some of the alternatives

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Cale Gibbard <[EMAIL PROTECTED]> wrote: > Personally, I think pt{x} for extracting the x field of pt seems > not-so-unreasonable, and meshes > well with the existing syntax for record updates. I should clarify -- this is only if we can't somehow keep the existing function syntax fo

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On the matter of extensible records, I really like the semantics of Daan Leijen's proposal here: http://research.microsoft.com/users/daan/download/papers/scopedlabels.pdf However, the syntax could use some work. Using (.) as a record selector is out of the question. Personally, I think pt{x} for

[Haskell] Extensible records: Static duck typing

2008-02-05 Thread Bulat Ziganshin
operty of course, drawback of duck typing that when we forgot to setup some field, this will be detected only at runtime - as usual for dynamic typing Haskell can provide benefits of both static and duck typing with type inference by means of extensible records. type of 'e' in this

[Haskell] Records

2007-09-16 Thread Barney Hilken
Now that I have a version of ghc with type classes, I have had a go at implementing records based on the ideas I mentioned on this list a few months ago. The code of my first attempt is available at http:// homepage.ntlworld.com/b.hilken/files/Records.hs I am releasing this to get feedback

[Haskell] HList with new records, in darcs.haskell.org

2006-07-02 Thread oleg
The HList library of strongly typed heterogenous lists, records, type-indexed products (TIP) and co-products is now accessible via DARCS http://darcs.haskell.org/HList/ The library contains a new representation for open records. Previously (Record.hs) a record is a Scheme-like

Re: [Haskell] extensible records using associated types

2006-06-25 Thread Barney Hilken
is the same as the type of 'r'. This can't be typed in Hugs because you can only update particular fields, but we can easily add it to (at least the quadratic version of) AT-records. Introduce a class 'subRecord r s' which means that every field of 's'

Re: [Haskell] extensible records using associated types

2006-06-22 Thread Barney Hilken
Manuel M T Chakravarty: This is problematic as the instance heads are distinguished only by the context; ie, both instances are for `Lacks m (N a r)'. Haskell's instance selection mechanism (with or without associated types) selects instances purely by looking at the arguments of the class;

Re: [Haskell] extensible records using associated types

2006-06-20 Thread Manuel M T Chakravarty
Barney Hilken: > Similarly, it Lacks all the fields which r Lacks, except for N > itself. This is where we really need the ordering :<: to ensure that > m is not equal to N. There are two cases, m :<: N: > > >instance m :<: N, Lacks m r => Lacks m (N a r) where > >type Extend

Re: [Haskell] extensible records using associated types

2006-06-20 Thread Barney Hilken
The implementation of records using types data N a r = N a r might well be inefficient, and I don't know enough about the workings of the compiler to see whether it could be improved by unboxing and strictness. But the real point of my post was the classes Contains, Lacks and Dis

Re: [Haskell] extensible records using associated types

2006-06-19 Thread Barney Hilken
Of course, under Usage, I should have written: The record {N1 = x1, ... Nn = xn} should be constructed as (extend N1 x1 $ ... $ extend Nn xn $ Empty). Sorry about any confusion! Barney. ___ Haskell mailing list Haskell@haskell.org http://www.haske

[Haskell] extensible records using associated types

2006-06-19 Thread Barney Hilken
I'm sorry if this example has already been posted, but I couldn't find it by searching the archives. If it's new (and works properly), it provides more evidence that ATs are a good thing. You can use associated type synonyms to implement polymorphic ext

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

2006-01-06 Thread oleg
foo :: (Num v, HasField (Proxy PtX) r v) => r -> [Char] David Roundy wrote: > I guess I meant to say that it hadn't been implemented for "real" records, > and there doesn't seem to be a consensus that it's the best approach. There had been no argument about wh

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

2006-01-06 Thread David Roundy
nar Karttunen. Here's an example: I guess I meant to say that it hadn't been implemented for "real" records, and there doesn't seem to be a consensus that it's the best approach. > > accessor r f = r # f > > *Test> :t accessor > acces

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 -- http://wager

[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

[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

Re: [Haskell] monads, records, verbosity

2006-01-05 Thread Philippa Cowderoy
On Thu, 5 Jan 2006, S. Alexander Jacobson wrote: > Much of the discussion here recently has been related to debate about > complexifying the monad hierarchy. The fact that Haskell record syntax is > abysmal and the verbosity of various possible solutions. > They appear to interrelate. > > Would

[Haskell] monads, records, verbosity

2006-01-05 Thread S. Alexander Jacobson
Much of the discussion here recently has been related to debate about complexifying the monad hierarchy. The fact that Haskell record syntax is abysmal and the verbosity of various possible solutions. They appear to interrelate. Would it be possible/reasonable to get rid of data, class, and i

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

2006-01-05 Thread David Roundy
On Wed, Jan 04, 2006 at 03:03:40PM -0800, John Meacham wrote: > 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 > > "foo"s in a given

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 > "foo"s in a given data type have the same type. Which I don't think is a > bad thing e

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

2006-01-04 Thread John Meacham
what type would f x = x { foo = "hello" } have if there were multiple types with 'foo' as a field name? John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

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

2006-01-04 Thread Iavor Diatchki
the 'setFoo' function? When you think about that, you are likely to run into the usual 'Has' or 'Lacks' predicates in the types. I think the same pattern pops up whenever you want to have labels access fields (for projection or update) in records of different types, becaus

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

2006-01-04 Thread John Goerzen
you can get by with the existing non-function update syntax, then you can > also get by with pattern matching to access record contents. I have a lot of code where I rarely need to update records but frequently need to access them. For instance: http://darcs.complete.org/hdbc/doc/Database-HDBC.h

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

2006-01-04 Thread David Roundy
On Tue, Jan 03, 2006 at 08:25:01PM -0500, Dylan Thurston wrote: > On Mon, Jan 02, 2006 at 08:43:56AM -0500, David Roundy wrote: > > data FooBar = Foo { foo :: Int } | FooBar = { foo :: Int, bar :: Int } > > > > desugars to something like > > > > data FooBar = Foo Int | FooBar Int Int > > > > foo

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

2006-01-04 Thread David Roundy
nt } | FooBar = { foo :: Int, bar :: Int } > > I would find this to be incredibly annoying. The fact that these > accessor functions exist automatically is, IMHO, one of the very nice > things about Haskell records. I have nightmares of manually coding up > hundreds of get* and set* f

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

2006-01-04 Thread John Goerzen
he fact that these accessor functions exist automatically is, IMHO, one of the very nice things about Haskell records. I have nightmares of manually coding up hundreds of get* and set* functions in Java from your proposal ;-) I also would consider it a bug to have something so annoying that a code-

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 quest

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-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 } > >>> > >>>I

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

2006-01-03 Thread Dylan Thurston
On Mon, Jan 02, 2006 at 08:43:56AM -0500, David Roundy wrote: > data FooBar = Foo { foo :: Int } | FooBar = { foo :: Int, bar :: Int } > > desugars to something like > > data FooBar = Foo Int | FooBar Int Int > > foo :: FooBar -> Int > foo (Foo f) = f > foo (FooBar f _) = f > bar :: FooBar -> In

[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? dat

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

2006-01-03 Thread David Roundy
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? > >

[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 Fo

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

2006-01-02 Thread Sebastian Sylvan
On 1/2/06, David Roundy <[EMAIL PROTECTED]> wrote: > Hi all, > > I'd like to humbly submit a conservative proposal for changes to the > records mechanism for Haskell '06. The plan for Haskell '06 (to the extent > that there is one) is to make it a conservative

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

2006-01-02 Thread David Roundy
On Mon, Jan 02, 2006 at 01:53:51PM +, Joel Reymont wrote: > Say you turned automatic generation of accessor functions off. You would > still need accessor functions, right? What would they look like if you > were to write them by hand? They could look identical if you wrote them by hand, but y

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

2006-01-02 Thread Joel Reymont
oblem that different records in a single namespace cannot share field names in a simple manner. In order to allow the writing of records code with is both valid Haskell 98 and valid Haskell '06, I'd suggest a pragma that causes the Haskell '06 compiler to generate the acce

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

2006-01-02 Thread David Roundy
Hi all, I'd like to humbly submit a conservative proposal for changes to the records mechanism for Haskell '06. The plan for Haskell '06 (to the extent that there is one) is to make it a conservative modification of Haskell 98, which is a good idea. As such, I don't thin

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-28 Thread Rob Ennals
On 11/28/05, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: > > As I already said, this approach may lead to mixing different concepts. > Example: > > data Person = Person { name :: String } > data File = File { name :: String } > > A field identifier has to be seen in context of the d

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-28 Thread Wolfgang Jeltsch
Am Sonntag, 27. November 2005 22:34 schrieb John Lask: > correct me if I am wrong but ... > > 1. Field namespaces: solved by using type classes > > This would imply that the type of the field is the same between all > instances of this common field. > > Under this proposal two fields with s

RE: [Haskell] Re: Records

2005-11-28 Thread Ralf Lammel
Good questions. You can't have a polymorphic typecase like "`extQ` (show :: Show a => a -> String )" because that's not really a *type*case. It is too polymorphic. You can have a polymorphic typecase like "`extQ` ( lshow :: [ a ] -> String )" because that's covered by the SYB2 paper; you need ex

[Haskell] Re: Records

2005-11-28 Thread Johannes Waldmann
s? Sure but by the same argument I wouldn't need records at all because I could use tuples :-) I'd say it makes the intention of the programmer more explicit, and this is what pragmatics of programming languages is all about, isn't it ... Also, for updates ( like x { foo =

[Haskell] Re: Records

2005-11-28 Thread Ketil Malde
;t you solve this by writing a fiunction to construct Foo with the desired properties? I.e. something like mkStdFoo f = Foo f (2*f) Or is there other functionality you would get by using records in this way? -k -- If I haven't seen further, it is by s

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-28 Thread Johannes Waldmann
able to hide the "computed" component, i. e. Foo { foo = 5, bar = 7 } could be forbidden. And still better: if we could say later (i. e. outside the definition of Foo) that the values of bar should be "memorized" in the Foo records. Of course this might be hard for separate c

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-28 Thread David Roundy
option. The other option would be some sort of syntax to declare that a particular record is unordered. Or I suppose to just give up on backward compatibility. Any of these three alternatives would be fine with me. > > > 7. Unordered records: yep (if I understand the problem correctly) &g

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-27 Thread John Lask
:: String }, { name :: Int } John - Original Message - From: "Rob Ennals" <[EMAIL PROTECTED]> To: "Johannes Waldmann" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, November 23, 2005 1:32 AM Subject: Re: Records (was Re: [Haskell] Improvements to GHC)

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-27 Thread Rob Ennals
bar :: String } > > there shouldn't be accessors of type > > foo :: FooBar -> String > bar :: FooBar -> String I did indeed misunderstand what you meant by "safe". Bottom is indeed a nasty thing. Perhaps such definitions should generate a warning? (banning them

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-24 Thread Keean Schupke
eltsch wrote: Am Mittwoch, 23. November 2005 14:22 schrieb David Roundy: On Tue, Nov 22, 2005 at 02:32:47PM +, Rob Ennals wrote: [...] 7. Unordered records: yep (if I understand the problem correctly) ... You can just omit the data constructors from the module&#x

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-24 Thread David Roundy
On Wed, Nov 23, 2005 at 02:58:43PM +0100, Wolfgang Jeltsch wrote: > Am Mittwoch, 23. November 2005 14:22 schrieb David Roundy: > > On Tue, Nov 22, 2005 at 02:32:47PM +, Rob Ennals wrote: > > [...] > > > > 7. Unordered records: yep (if I understand the problem co

Re[2]: Records (was Re: [Haskell] Improvements to GHC)

2005-11-23 Thread Bulat Ziganshin
Hello David, Wednesday, November 23, 2005, 4:22:47 PM, you wrote: >> 7. Unordered records: yep (if I understand the problem correctly) DR> I don't think you understood correctly. What I'd like (and this is another DR> one of those David-specific issues--I've never he

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-23 Thread Wolfgang Jeltsch
Am Mittwoch, 23. November 2005 14:22 schrieb David Roundy: > On Tue, Nov 22, 2005 at 02:32:47PM +, Rob Ennals wrote: > [...] > > 7. Unordered records: yep (if I understand the problem correctly) > > I don't think you understood correctly. What I'd like (and th

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-23 Thread Malcolm Wallace
David Roundy <[EMAIL PROTECTED]> writes: > > 7. Unordered records: yep (if I understand the problem correctly) > > I don't think you understood correctly. What I'd like (and this is another > one of those David-specific issues--I've never heard anyone else

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-23 Thread David Roundy
On Tue, Nov 22, 2005 at 02:32:47PM +, Rob Ennals wrote: > Since discussion has returned to records, it might be useful for me to > post a link to a proposal that I knocked up a while back when this > topic came up a few years ago: > > http://www.cambridge.intel-resear

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-23 Thread Rob Ennals
Hi guys, Since discussion has returned to records, it might be useful for me to post a link to a proposal that I knocked up a while back when this topic came up a few years ago: http://www.cambridge.intel-research.net/~rennals/records.pdf The basic idea is to keep records largely as they are

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-22 Thread Johannes Waldmann
On records in Haskell - can we start by formulating requirements (design goals). What do we want from a record system, and what are non-goals. Some of the proposals here sound like records should be more like objects (with some kind of inheritance). Do we really want this? We already have

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-22 Thread Gracjan Polak
2005/11/20, Georg Martius <[EMAIL PROTECTED]>: > 7. Unordered records. > I don' t understand it. > Consider this example: data DataT = DataT (Int,String) (String,String) if we treat records as tuples with labels, then we could write: data DataR = DataR {tel::In

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-21 Thread Andrew Pimlott
On Sun, Nov 20, 2005 at 08:54:35AM -0500, David Roundy wrote: > As an aside, what's responsible for the insanity of pattern matching record > fields being backwards? I'd bar = b to bind b to bar, not the other way > around... why should record pattern matching use '=' in a manner opposite > from th

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-20 Thread Tomasz Zielonka
On Sun, Nov 20, 2005 at 02:09:04PM -0500, David Roundy wrote: > > [x,y,z] > [...] > > R { field1 = x, field2 = y, field3 = z } > > > > I think this is very consistent. > > I see, you're right that it's consistent, but I still don't like the use of > '=' in this scenario. I understand you

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-20 Thread David Roundy
On Sun, Nov 20, 2005 at 03:43:08PM +0100, Tomasz Zielonka wrote: > On Sun, Nov 20, 2005 at 08:54:35AM -0500, David Roundy wrote: > > As an aside, what's responsible for the insanity of pattern matching > > record fields being backwards? I'd bar = b to bind b to bar, not the > > other way around...

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-20 Thread Wolfgang Jeltsch
Am Sonntag, 20. November 2005 13:40 schrieb Georg Martius: > [...] > 4. Getters for multiple data types with a common field. Do we need this? Couldn't this have ugly consequences? Say, I have a datatype with a field of a certain name and another datatype with a field of the same name. Having

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-20 Thread Tomasz Zielonka
On Sun, Nov 20, 2005 at 08:54:35AM -0500, David Roundy wrote: > As an aside, what's responsible for the insanity of pattern matching record > fields being backwards? I'd bar = b to bind b to bar, not the other way > around... why should record pattern matching use '=' in a manner opposite > from th

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-20 Thread David Roundy
On Sun, Nov 20, 2005 at 01:40:01PM +0100, Georg Martius wrote: > 7. Unordered records. > I don' t understand it. It's just that I'd like to be able to write: data FooBar = FooBar { foo, bar :: String } such that you can't write let f = FooBar "a"

Records (was Re: [Haskell] Improvements to GHC)

2005-11-20 Thread Georg Martius
Hi folks, rather than discussing about which operator symbol to use for record access, which is really a question of personal taste we should try to seriously discuss the proposals and get to a solutions! We all seem to agree that records are broken in Haskell. In order to fix that we need a

RE: access to fields in nested records

2003-11-05 Thread Tim Docker
(Apologies for previous incomplete post: Here's the whole thing) One thing that bugs me about the named record syntax, is that with a datatype: data T = T { t_f1 :: X, t_f2 :: X }; the function t_f1 has the type of an "accessor", ie t_f1 :: T -> X but there doesn't any tidy wa

Re: access to fields in nested records

2003-11-05 Thread Robert Ennals
> DRiFT will let you do that, by deriving get_ and set_ methods, but other > than that, no. THere was discussion about a year ago (I think) about > this, with proposed syntax for something, but it never really got off the > ground. You can probably google for it with my name and some other >

RE: access to fields in nested records

2003-11-05 Thread Hal Daume III
DRiFT will let you do that, by deriving get_ and set_ methods, but other than that, no. THere was discussion about a year ago (I think) about this, with proposed syntax for something, but it never really got off the ground. You can probably google for it with my name and some other keywords -

  1   2   >