[Haskell-cafe] A better syntax for qualified operators?

Henning Thielemann lemming at henning-thielemann.de
Thu Sep 28 15:32:50 EDT 2006

On Wed, 27 Sep 2006, Brian Hulley wrote:

> Hi -
> Consider the scenario when you want to find a function that returns the i'th
> element of an array but all you know is that there is a module called
> Data.Array.IArray that will probably have such a function in it. So you start
> typing in your program:
>    let
>        ith = Data.Array.IArray.
> at this point, you'd hope the editor you're using would somehow display a list
> of avaliable values exported from Data.Array.IArray including the indexing
> function, so you could select it, thus I would *like* to be able to use the
> syntax:
>    let
>        ith = Data.Array.IArray.(!)
> because it's not the user's fault that the person who wrote Data.Array.IArray
> decided to use a symbol instead of an identifier for this function - the user
> of Data.Array.IArray in this case just wants to see normal identifiers to use
> with prefix application so the use of (!) at this point effectively gets rid
> of the unwanted operatorness associated with the function.

This cool editor is able to show a list of functions with the given
qualification but is not able to enclose the qualified identifier in
parentheses? I don't think that it is a good idea to move the
qualification away from the qualified identifier. The parentheses around
the infix operator are a special case of sections. With the proposed
syntactic change, we would have two meanings of parentheses: Section and
making an infix operator prefix. One can also mix up
    more easily with function composition
  Data.Array.IArray . (!)
    if Data.Array.IArray is also a constructor.

More information about the Haskell-Cafe mailing list