RE: infix type operators

OK, it's done for 6.4 SImon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Ross Paterson | Sent: 08 March 2005 16:29 | To: glasgow-haskell-users@haskell.org | Subject: infix type operators | | The User's Guide says: | | The only thing that differs between operators in types and | operators in expressions is that ordinary non-constructor | operators, such as + and * are not allowed in types. Reason: | the uniform thing to do would be to make them type variables, | but that's not very useful. A less uniform but more useful thing | would be to allow them to be type constructors. But that gives | trouble in export lists. So for now we just exclude them. | | Conal has pointed out that the uniform thing would be useful for | general arrow combinators: | | liftA2 :: Arrow (~>) => | (a -> b -> c) -> (e ~> a) -> (e ~> b) -> (e ~> c) | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

[warning: Very Vague message & possible bug-report follow] Though I cannot claim any real-world experience with arrows, I'm not sure I like this, and I hope they'll at least remain experimental (may be removed next release kind of thing) for a while. - I doubt whether the difference between "Arrow a => a b c" and "Arrow (~>) => b ~> c" is all that great. Or even, whether the perhaps slightly improved readability of "b ~> c" makes up for the IMO slightly decreased readability of "Arrow (~>)". - When one really needs to do it infix, one can always write "Arrow a => b `a` c". - It's one thing more to learn. The difference between types and typevariables (upper/lowercase) is better visible than the difference between operator(variables) and infix-types ("Does it start with a colon?") Which, I have to admit, is more of a vague feeling than anything like a fact. - We already have the special case of -> as a _type_, not a typevariable, and having -> as a type, :-> as a type and ->: as a typevariable doesn't sound too great. Of course, as -> is special in expression context too, that may not be convincing either :( So I guess I'll have to end this mail with "there is at least one person not feeling entirely comfortable about it" :) Would it at least be possible to make it a seperate flag from -fglasgow-exts? (I'm slightly worried about people needing one extension and then using the rest too just because they're already enabled, so actually this doesn't apply only to this particular feature.) Groetjes, Remi On Wed, Mar 09, 2005 at 05:06:03PM -0000, Simon Peyton-Jones wrote:
OK, it's done for 6.4
SImon
| -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Ross Paterson | Sent: 08 March 2005 16:29 | To: glasgow-haskell-users@haskell.org | Subject: infix type operators | | The User's Guide says: | | The only thing that differs between operators in types and | operators in expressions is that ordinary non-constructor | operators, such as + and * are not allowed in types. Reason: | the uniform thing to do would be to make them type variables, | but that's not very useful. A less uniform but more useful thing | would be to allow them to be type constructors. But that gives | trouble in export lists. So for now we just exclude them. | | Conal has pointed out that the uniform thing would be useful for | general arrow combinators: | | liftA2 :: Arrow (~>) => | (a -> b -> c) -> (e ~> a) -> (e ~> b) -> (e ~> c)
-- Nobody can be exactly like me. Even I have trouble doing it.

On Wed, Mar 09, 2005 at 11:59:40PM +0100, Remi Turk wrote:
- It's one thing more to learn. The difference between types and typevariables (upper/lowercase) is better visible than the difference between operator(variables) and infix-types ("Does it start with a colon?") Which, I have to admit, is more of a vague feeling than anything like a fact.
On the contrary: it's one less exception to remember. With this change, the lexical syntax of type variables and type constructors is exactly the same as that for data variables and data constructors respectively, except that there are some special type constructors (->), (), (,,), etc, just as there are some special data constructors like 1.7, (), (,,) etc.

Agreed. I was surprised by the language inconsistency when I discovered that symbols were ruled out for type variables. It just seemed natural to me when programming with arrows, and I'm surprised it hasn't shown itself useful before. - Conal -----Original Message----- From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of ross@soi.city.ac.uk Sent: Wednesday, March 09, 2005 4:58 PM To: Remi Turk Cc: glasgow-haskell-users@haskell.org; Simon Peyton-Jones Subject: Re: infix type operators On Wed, Mar 09, 2005 at 11:59:40PM +0100, Remi Turk wrote:
- It's one thing more to learn. The difference between types and typevariables (upper/lowercase) is better visible than the difference between operator(variables) and infix-types ("Does it start with a colon?") Which, I have to admit, is more of a vague feeling than anything like a fact.
On the contrary: it's one less exception to remember. With this change, the lexical syntax of type variables and type constructors is exactly the same as that for data variables and data constructors respectively, except that there are some special type constructors (->), (), (,,), etc, just as there are some special data constructors like 1.7, (), (,,) etc. _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (4)
-
Conal Elliott
-
Remi Turk
-
ross@soi.city.ac.uk
-
Simon Peyton-Jones