Representing Tuple types as products

Here's a random idea that popped into my head. There have been a few discussions about unicode support in Haskell'. One of the particular places this is useful would appear to be type signatures, I was considering that it would be particularly neat to be able to represent tuples as cross products if the user so desired. As such: fst :: α × β → α would be equivalent to: fst :: (α, β) → α Just random thought for the day, what do people think? Bob

Personally, I'd love support for this sort of thing. It's easy to set
up your keyboard (at least in Gnome) to be able to type greek
characters and to add a compose key for lots of the unicode magic. If
this is done, it might be a good idea for someone to write a tool to
sugar/desugar the unicode for the benefit of those who are on
terminals which don't support it.
Currently in GHC, we have the problem that it seems impossible to put
unicode characters in source files at all, even in string literals.
- Cale
On 05/02/06, Thomas Davie
Here's a random idea that popped into my head. There have been a few discussions about unicode support in Haskell'. One of the particular places this is useful would appear to be type signatures, I was considering that it would be particularly neat to be able to represent tuples as cross products if the user so desired. As such:
fst :: α × β → α would be equivalent to: fst :: (α, β) → α
Just random thought for the day, what do people think?
Bob _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime

Thomas Davie wrote:
fst :: α × β → α
even without Unicode we could allow fst :: a * b -> a like ML. But I'm not sure I like this. ((a,b),c) and (a,(b,c)) and (a,b,c) all feel distinct to me, but (a*b)*c, a*(b*c) and a*b*c feel the same. I could easily get used to it, but I doubt I'd use it as long as the old syntax remained available. -- Ben

On 6 Feb 2006, at 13:58, Ben Rudiak-Gould wrote:
Thomas Davie wrote:
fst :: α × β → α
even without Unicode we could allow
fst :: a * b -> a
like ML. But I'm not sure I like this. ((a,b),c) and (a,(b,c)) and (a,b,c) all feel distinct to me, but (a*b)*c, a*(b*c) and a*b*c feel the same. I could easily get used to it, but I doubt I'd use it as long as the old syntax remained available.
Indeed, I think this only really becomes applicable when unicode is available, because we're all used to seeing tuples being written as cross products on the theoretical side of things. I'm just thinking that if we can get closer to the maths by using the greek letters, can we also get closer by using the same syntax? I suspect that I would use it, but only where I was doing something like directly implementing an abstract machine - i.e. when I want the Haskell to look as much like the theory as possible. Bob

On Feb 6, 2006, at 8:58 AM, Ben Rudiak-Gould wrote:
Thomas Davie wrote:
fst :: α × β → α
even without Unicode we could allow
fst :: a * b -> a
like ML. But I'm not sure I like this.
I am on the record as hating this with a burning passion, personally. This is one of those places where mathematical notation actually obscures rather than clarifying. Continuing the error in ML was a mistake. Fundamentally, I *like* that the k-tuple type in Haskell looks like a k-tuple, and not some randomly-associated infix binary operator. -Jan-Willem Maessen
((a,b),c) and (a,(b,c)) and (a,b,c) all feel distinct to me, but (a*b)*c, a*(b*c) and a*b*c feel the same. I could easily get used to it, but I doubt I'd use it as long as the old syntax remained available.
-- Ben
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime

On Mon, Feb 06, 2006 at 07:45:34PM -0500, Jan-Willem Maessen wrote:
I am on the record as hating this with a burning passion, personally. This is one of those places where mathematical notation actually obscures rather than clarifying. Continuing the error in ML was a mistake. Fundamentally, I *like* that the k-tuple type in Haskell looks like a k-tuple, and not some randomly-associated infix binary operator.
Indeed, I think the unification of the type and term syntax was one of the great innovations of haskell (or at least the choice to inherit it). some mechanism to declare such aliases locally might be interesting, you would just need to declare the cross-product symbol to be a type synonym for (,) but that would be tricky as type synonyms have to be in the constructor space so we'd need something like top level type variables.. (or just declare the cross product symbol is in the constructor space) neither of which is very attractive.. John -- John Meacham - ⑆repetae.net⑆john⑈
participants (5)
-
Ben Rudiak-Gould
-
Cale Gibbard
-
Jan-Willem Maessen
-
John Meacham
-
Thomas Davie