[Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)
Greg Woodhouse
gregory.woodhouse at sbcglobal.net
Thu Nov 17 15:15:34 EST 2005
--- Cale Gibbard <cgibbard at gmail.com> wrote:
> Actually, I didn't mention this in the other post, but why not the
> other way around? Make record selection (#) or (!) (though the latter
> gets in the way of array access), and leave (.) for function
> composition.
Actually, the fact that (!) is the array selector makes it all the more
attractive as a record selector. (It does make you wonder if a record
isn't a kind of a typed associative array, though...)
> Personally, I'd like something which looked like an
> arrow
> for record selection, but most of the good 2-character ones are
> unavailable. (~>) is a bit hard to type and looks wrong in some
> fonts.
Well, yeah, but the arrows have such a fundamentally different meaning
in Haskell. (I thought of that one, too).
> There's a "triangle" which is not taken, and isn't so hard to type
> (|>).
If we're not careful, though, Haskell will end up looking like APL.
>
> I never really understood the attachment to (.) for record selection.
> There's no reason that we have to make things look like Java and C.
>
> Another option is to make application of a label to a record mean
> projection, somewhat like things currently are, though since labels
> aren't really functions anymore that is potentially confusing.
>
Actually, I thought of that, too, or rather something like
get label record
or
get record label
(I haven't made up my mind which way the currying makes more sense. Do
you have a generic function for getting records with a certain label,
or do you apply "get label", tget the field with this label, to
record?)
> - Cale
>
===
Gregory Woodhouse <gregory.woodhouse at sbcglobal.net>
"Interaction is the mind-body problem of computing."
--Philip Wadler
More information about the Haskell-Cafe
mailing list