"Serge D. Mechveliani" <mech...@botik.ru> writes:

| On Tue, Feb 14, 2012 at 02:54:17AM -0600, Gabriel Dos Reis wrote:
| > "Serge D. Mechveliani" <mech...@botik.ru> writes:
| > 
| > | In Spad,  rc.foo  
| > | 
| > | selects a field named  foo  in a record  rc.
| > | In Haskell, this is  
| > |                     foo rc   -- similar as applying any function.
| > | 
| > | Indeed,  foo  has type  Record(foo : Foo, ...) -> Foo.
| > | In particular, it allows, for example,  
| > |                               map foo (records :: List Record(...)).
| > 
| > Haskell does not really have first class records, Haskell' folks are
| > agonizing over how to properly define records in Haskell and what to do
| > with the dot notation.  See the various record and dot proposals and
| > ongoing discussion on Haskell' list.
| > 
| >   http://hackage.haskell.org/trac/ghc/wiki/Records/DotOperator
| > [..]
| 
| 
| 1. I think, it has quite good records. For example,
| 
| --------------------------------------------------
| data Gauss r = Gauss {real :: r, im :: r}
|                -- a record
| 
| -- '::' means ':' of Spad.
| -- `r'  a parameter, which can be viewed as say IntegralDomain.
| 
| testL = [g, g {im = 2}, g {im = 3}]       -- a list of three "G-numbers"
|         where
|         g = Gauss {real = 0, im = 1}  :: Gauss Int
| --------------------------------------------------
| 
| Then:    (im (head testL)) + 3  -->  4,
|          map im testL           -->  [1, 2, 3]
| 
| Why do you say that it does not really have first class records?

because, all the above lets you do is to name a particular field of a
particular data type.  It does not allow you to use the same name for
the field of a completely different data type.

| 2. As I understand, the current Haskel discussion on records is of
|    _how to develop the denotations further_,  to an even better state.
| Because the Haskell conflict is only between good and even better :-)

I think that misses the fundamental point of the current discussion in
the Haskell community.

| 
| For example, the next problem is  the field name overloading.
| For example, how to allow  'im'  to appear in different records, and its 
| type to be found correctly. Inventing various kinds of a sugar.
| I never followed the whole discussion.
| But in principle,  g.im  still can be converted by the compiler to  (im g),
| there are possible various denotations.
| 
| My aim was only to point at the idea.

I understood that.  I was just pointing out that Spad's situation is a
bit ahead of that of Haskell on this specific point.

-- Gaby

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to