[Haskell-cafe] Re: map (-2) [1..5]
simonpj at microsoft.com
Mon Sep 11 05:47:27 EDT 2006
| Well, it seems a shame that we don't have postfix operators already.
| I guess that means I am arguing we should introduce a unary postfix
| operator, and not even have sugar for factorial, as it conflicts with
| array access.
| We *almost* do:
| Hugs.Base> let (!) 0 = 1; (!) x = x*((!) (x-1)) in (5 !)
| Prelude> let (!) 0 = 1; (!) x = x*((!) (x-1)) in (5 !)
Actually, the up-coming GHC 6.6 does allow this. Some while ago I made
the type checker a tiny bit more lenient about
left sections, so that
would typecheck iff
(Strictly, Haskell 98 requires that the section typechecks iff
(\y. (!) x y)
typechecks, and I should really have made the relaxation dependent on
flag, but I didn't.)
Anyway, you get postfix operators. I'd better document this.
More information about the Haskell-Cafe