[Haskell-cafe] Re: map (-2) [1..5]

Simon Peyton-Jones 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 !)
| Sadly,
| 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 
  	(x !)
  would typecheck iff
  	((!) x) 
  typechecks.  
  
(Strictly, Haskell 98 requires that the section typechecks iff
  	(\y. (!) x y)
  typechecks, and I should really have made the relaxation dependent on
a 
  flag, but I didn't.)

Anyway, you get postfix operators.  I'd better document this.

Simon


More information about the Haskell-Cafe mailing list