Consistency of reserved operators and bang patterns
Isaac Dupree
isaacdupree at charter.net
Fri Sep 7 20:24:51 EDT 2007
Twan van Laarhoven wrote:
> The bang pattern proposal [1] still allows (!) to be used as an
> operator. I think there should be no difference in this regard between !
> and ~, since they are used in exactly the same location.
>
> In my opinion the best thing would be to allow (~) and (@) as operators.
> With the same restriction on definition as (!), i.e. they must be
> defined in function style, not as an operator.
>
> The change to the syntax would be to remove @ and ~ from the reserved
> operators list [2],
> reservedop -> .. | : | :: | = | \ | | | <- | -> | @ | ~ | =>
> making it
> reservedop -> .. | : | :: | = | \ | | | <- | -> | =>
I agree - it confused me in the past that I couldn't define (@) or (~)
operators. Bang-pattern syntax being active will still change the
meaning of
x ! y = z
of course.
> Oh, and while we are at it, I think (:) should also be removed as a
> reservedop, there is no reason for it to be on that list.
Backwards compatibility requires that it be implicitly imported from
Prelude even in a module that does "import Prelude ( )" (although Hugs
is already broken in this regard). And that makes it fairly useless as
a non-reserved symbol. If not for that issue, I agree.
Isaac
More information about the Haskell-prime
mailing list