On Tue, Feb 14, 2012 at 02:54:17AM -0600, Gabriel Dos Reis wrote:
> "Serge D. Mechveliani" <[email protected]> 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?
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 :-)
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.
Regards,
------
Sergei
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.