Re: Records in Haskell

2011-12-21 Thread Matthew Farkas-Dyck
Fair enough. On 20/12/2011, Chris Smith cdsm...@gmail.com wrote: On Tue, Dec 20, 2011 at 5:57 PM, Matthew Farkas-Dyck strake...@gmail.com wrote: Another thought: Perhaps bang as record selection operator. It would avoid further corner cases of dot, and it's not unprecedented in Haskell

Re: Records in Haskell

2011-12-20 Thread Matthew Farkas-Dyck
Another thought: Perhaps bang as record selection operator. It would avoid further corner cases of dot, and it's not unprecedented in Haskell (e.g. Data.Map.!). If one wished to use dot, one could do this: import Prelude hiding ((.)); import Control.Category.Unicode((∘)); (.) = (!);

Re: Records in Haskell

2011-12-20 Thread Chris Smith
On Tue, Dec 20, 2011 at 5:57 PM, Matthew Farkas-Dyck strake...@gmail.com wrote: Another thought: Perhaps bang as record selection operator. It would avoid further corner cases of dot, and it's not unprecedented in Haskell (e.g. Data.Map.!). We already have weird syntax rules for dot, and the

Re: Records in Haskell

2011-11-08 Thread Wolfgang Jeltsch
Am Montag, den 07.11.2011, 21:41 + schrieb Barney Hilken: The problem with this approach is that different labels do not have different representations at the value level. I think this is an advantage, because it means you don't have to carry this stuff about at runtime. This

RE: Records in Haskell

2011-11-08 Thread Wolfgang Jeltsch
Am Montag, den 07.11.2011, 23:30 + schrieb Simon Peyton-Jones: Wolfgang Is there a wiki page giving a specific, concrete design for the proposal you advocate? Something at the level of detail of http://hackage.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields? Well, I don’t

Re: Records in Haskell

2011-11-08 Thread Claus Reinke
My stance is that it is possibly better if we do not try to include a one-size-fits-it-all record system into the language, but if the language provided support for basic things that almost all record system *libraries* would need. Agreed. To the extent that such libraries could be improved

Re: Records in Haskell

2011-11-07 Thread Claus Reinke
I am unsure which of this list of proposals you are referring to. The URL you quote is this http://hackage.haskell.org/trac/haskell-prime/wiki/FirstClassLabels That sounds familiar, I think I wrote that when I was younger;-) but it doesn't seem to actually contain a design, merely some

Re: Records in Haskell

2011-11-07 Thread Wolfgang Jeltsch
Am Montag, den 07.11.2011, 17:53 + schrieb Barney Hilken: Here is my understanding of the current state of the argument: Instead of Labels, there will be a new kind String, which is not a subkind of *, so its elements are not types. The elements of String are strings at the type level,

Re: Records in Haskell

2011-11-07 Thread Wolfgang Jeltsch
Am Montag, den 07.11.2011, 18:16 +0100 schrieb Claus Reinke: I am unsure which of this list of proposals you are referring to. The URL you quote is this http://hackage.haskell.org/trac/haskell-prime/wiki/FirstClassLabels That sounds familiar, I think I wrote that when I was younger;-)

Re: Records in Haskell

2011-11-07 Thread Edward Kmett
On Mon, Nov 7, 2011 at 1:33 PM, Wolfgang Jeltsch g9ks1...@acme.softbase.org wrote: Am Montag, den 07.11.2011, 18:16 +0100 schrieb Claus Reinke: I am unsure which of this list of proposals you are referring to. The URL you quote is this

Re: Records in Haskell

2011-11-07 Thread Barney Hilken
The problem with this approach is that different labels do not have different representations at the value level. I think this is an advantage, because it means you don't have to carry this stuff about at runtime. This allows me to pattern match records, since I can construct record

Re: Records in Haskell

2011-11-07 Thread Ian Lynagh
On Mon, Nov 07, 2011 at 08:31:04PM +0200, Wolfgang Jeltsch wrote: The problem with this approach is that different labels do not have different representations at the value level. In my record system, I use label definitions like the following ones: data MyName1 = MyName1 data

Re: Records in Haskell

2011-11-07 Thread Edward Kmett
Ian said class Has (r :: *) (ft :: *) (f :: ft) (t :: *) where (where ft stands for field type)? class Has (r :: *) (f :: ft) (t :: *) where would be my understanding of how it would be phrased under the current polymorphic kind system. This could also solve the representation-hiding

RE: Records in Haskell

2011-11-07 Thread Simon Peyton-Jones
...@haskell.org [mailto:glasgow-haskell-users- | boun...@haskell.org] On Behalf Of Wolfgang Jeltsch | Sent: 07 November 2011 18:31 | To: glasgow-haskell-users@haskell.org | Subject: Re: Records in Haskell | | Am Montag, den 07.11.2011, 17:53 + schrieb Barney Hilken: | Here is my

Re: Records in Haskell

2011-11-04 Thread Matthew Farkas-Dyck
- let x.k = value in x)) On 20/10/2011, Simon Peyton-Jones simo...@microsoft.com wrote: | Subject: Re: Records in Haskell | | I have added my proposal to the wiki.The only downsides to it that I can see are: Thanks to Barney for articulating a proposal for records in Haskell. Over various plane

Re: Records in Haskell

2011-11-04 Thread Matthew Farkas-Dyck
On 04/11/2011, Simon Peyton-Jones simo...@microsoft.com wrote: | I really like Simon PJ's proposal for records in Haskell. Some | reasons for this are: Which one? You'll need to give your readers an explicit link S Sorry.

RE: Records in Haskell

2011-10-20 Thread Simon Peyton-Jones
| Subject: Re: Records in Haskell | | I have added my proposal to the wiki.The only downsides to it that I can see are: Thanks to Barney for articulating a proposal for records in Haskell. Over various plane rides and ICFP chats I've worked out some more details. It's not as simple as I'd

Re: Records in Haskell

2011-10-02 Thread Florian Weimer
* Simon Peyton-Jones: Provoked the (very constructive) Yesod blog post on Limitations of Haskell, and the follow up discussion, I've started a wiki page to collect whatever ideas we have about the name spacing issue for record fields.

Re: Records in Haskell

2011-09-18 Thread Thomas Schilling
On 16 September 2011 16:31, Ryan Newton rrnew...@gmail.com wrote: I started playing around with Leksah and scion/emacs (searching for what's the type of this expr support) and was a little disappointed that this functionality doesn't seem to exist yet.  Or am I wrong and it exists

Re: Records in Haskell

2011-09-16 Thread Ian Lynagh
On Fri, Sep 16, 2011 at 06:46:35AM +0100, Ganesh Sittampalam wrote: On 15/09/2011 15:43, Ian Lynagh wrote: On Thu, Sep 15, 2011 at 08:47:30AM +, Simon Peyton-Jones wrote: Re TypeDirectedNameResolution, I would actually prefer it if it were less general. i.e. if you were to write

Re: Records in Haskell

2011-09-16 Thread Simon Marlow
On 15/09/2011 14:03, Barney Hilken wrote: As formulated on the wiki page, the narrow issue is a problem without a good solution. The reason the community rejected TDNR is because it's basically polymorphism done wrong. Since we already have polymorphism done right, why would we want it? I

Re: Records in Haskell

2011-09-16 Thread Barney Hilken
I have added my proposal to the wiki.The only downsides to it that I can see are: 1. If the types can be resolved at compile time, the compiler needs to optimise away the dictionaries, otherwise there will be a performance cost. Since this is always the case for type classes, I assume this is

Re: Records in Haskell

2011-09-16 Thread Ryan Newton
One benefit of TDNR is to replicate the discoverability of APIs that OO programming has - if x :: Foo then typing x. in an IDE gives you a list of things you can do with a Foo. (Obviously it's not a complete lis for various reasons, but it does allow the author of Foo and others to design

Re: Records in Haskell

2011-09-15 Thread Christopher Done
I added my evaluation of the module-based approach to existing records, but on second thoughts it's maybe inappropriate, so I'll post it here. I saw that some people commented on the reddit discussion that the solution is to put your types in separate modules but it doesn't seem that anyone has

Re: Records in Haskell

2011-09-15 Thread Barney Hilken
As formulated on the wiki page, the narrow issue is a problem without a good solution. The reason the community rejected TDNR is because it's basically polymorphism done wrong. Since we already have polymorphism done right, why would we want it? The right way to deal with records is first to

Re: Records in Haskell

2011-09-15 Thread J. Garrett Morris
On Thu, Sep 15, 2011 at 6:03 AM, Barney Hilken b.hil...@ntlworld.com wrote: The right way to deal with records is first to agree a mechanism for writing a context which means        a is a datatype with a field named n of type b then give the selector n the type        a is a datatype with

Re: Records in Haskell

2011-09-15 Thread Christopher Done
TRex is already mentioned on the wiki as coming at a too high implementation cost. 2011/9/15 J. Garrett Morris jgmor...@cs.pdx.edu: On Thu, Sep 15, 2011 at 6:03 AM, Barney Hilken b.hil...@ntlworld.com wrote: The right way to deal with records is first to agree a mechanism for writing a context

Re: Records in Haskell

2011-09-15 Thread Ian Lynagh
On Thu, Sep 15, 2011 at 08:47:30AM +, Simon Peyton-Jones wrote: Provoked the (very constructive) Yesod blog post on Limitations of Haskell, and the follow up discussion, I've started a wiki page to collect whatever ideas we have about the name spacing issue for record fields.

RE: Records in Haskell

2011-09-15 Thread Simon Peyton-Jones
J Garrett Morris asked me | I also rather like the TDNR proposal, as it's rather similar to the | approach we're taking in Habit (our pet language at Portland State). | However, I'm curious as to why you don't want to quantify over name | resolution constraints. For example, why shouldn't: | |

Re: Records in Haskell

2011-09-15 Thread Christopher Done
I personally really like the proposal here: http://research.microsoft.com/en-us/um/people/simonpj/Haskell/records.html The wiki doesn't show any opposition to this system. If Haskell had that record system now I would be very happy and would be fine with leaving other record systems as purely

Re: Records in Haskell

2011-09-15 Thread Greg Weber
Chris, Thank you for the real word experience report. I had assumed (because everyone else told me) that importing qualified would be much, much better than prefixing. I had thought that in your case since you are big on model separation that you would have liked having a separate file for each

Re: Records in Haskell

2011-09-15 Thread J. Garrett Morris
On Thu, Sep 15, 2011 at 7:51 AM, Simon Peyton-Jones simo...@microsoft.com wrote: class Select (rec :: *) (fld :: String) where  type ResTy rec fld:: *  get :: rec - ResTy rec fld data T = MkT { x,y :: Int } instance Select T x where  get (MkT {x = v}) = v And now we desugar    f.x as  

Re: Records in Haskell

2011-09-15 Thread Christopher Done
2011/9/15 Greg Weber g...@gregweber.info: Chris, Thank you for the real word experience report. I had assumed (because everyone else told me) that importing qualified would be much, much better than prefixing. I had thought that in your case since you are big on model separation that you would

Re: Records in Haskell

2011-09-15 Thread Greg Weber
I should be clear that in my counter point I am using Ruby, not Haskell on those projects. In Ruby one can use a string for the name of a class (which will be evaluated later) and other general dynamic typing tricks to avoid cyclical dependencies. I have worked on one large Yesod project. I felt

Re: Records in Haskell

2011-09-15 Thread Christopher Done
2011/9/15 Greg Weber g...@gregweber.info: I should be clear that in my counter point I am using Ruby, not Haskell on those projects. In Ruby one can use a string for the name of a class (which will be evaluated later) and other general dynamic typing tricks to avoid cyclical dependencies. Ah,

Re: Records in Haskell

2011-09-15 Thread Barney Hilken
Here is a simple concrete proposal: Nonextensible records with polymorphic selectors. = 1. Introduce a built-in class Label, whose members are strings at the type level. We need a notation for them; I will use double single quotes, so ''string''

Re: Records in Haskell

2011-09-15 Thread Barney Hilken
Typos in my last message: the identifier field should be Field throughout, and undef should be undefined. Here is the corrected version: Nonextensible records with polymorphic selectors. = 1. Introduce a built-in class Label, whose members are

Re: Records in Haskell

2011-09-15 Thread Evan Laforge
It ''also'' demonstrated, to me, that qualified imports are horrible when used on a large scale. It happened all the time, that'd I'd import, say, 10 different data types all qualified.  Typing map (Foo.id . BarMu.thisField) and foo Bar.Zot{x=1,y=2} becomes tedious and distracting, especially

Re: Records in Haskell

2011-09-15 Thread Ganesh Sittampalam
On 15/09/2011 15:43, Ian Lynagh wrote: On Thu, Sep 15, 2011 at 08:47:30AM +, Simon Peyton-Jones wrote: Provoked the (very constructive) Yesod blog post on Limitations of Haskell, and the follow up discussion, I've started a wiki page to collect whatever ideas we have about the name

<    1   2   3