Proposal: change to qualified operator syntax

Simon Marlow marlowsd at gmail.com
Mon Apr 21 17:42:51 EDT 2008


Dan Weston wrote:
> Would it not be cleaner just to disallow infix notation of qualified 
> operators altogether? It is clear enough to use "import qualified" or 
> let or where clauses containing prefix notation to identify a qualified 
> operator with an unqualified one:
> 
> UGLY:
> 
> m `Prelude.(>>=)` a
>   `Prelude.(>>=)` b
>   `Prelude.(>>=)` c
> 
> 
> CLEAR:
> 
> m >>= a >>= b >>= c
>   where (>>=) = Prelude.(>>=)
> 
> [Personally, I prefer where to let for such purely syntactic details].

I did consider doing that, and it is certainly an option.  The reasons I 
chose to allow the infix forms are:

  - if you add an import and introduce a name clash, then you want
    to resolve clashes by just modifying the names, not by
    refactoring code.  The trick from your example above works,
    but it requires that all instances of (>>=) are
    in scope qualified, otherwise you get a shadowing warning.

  - it's cheap in terms of grammar and implementation.

Cheers,
	Simon


> Dan
> 
> Simon Marlow wrote:
>> Folks,
>>
>> Please comment on the following proposed change to qualified operator 
>> syntax:
>>
>>   http://hackage.haskell.org/trac/haskell-prime/wiki/QualifiedOperators
>>
>> Cheers,
>>     Simon
>>
>> _______________________________________________
>> Haskell-prime mailing list
>> Haskell-prime at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-prime
>>
>>
> 



More information about the Haskell-prime mailing list