[Haskell-cafe] Section Syntax Errors

Henning Thielemann lemming at henning-thielemann.de
Mon Nov 13 08:59:54 EST 2006


On Sat, 11 Nov 2006, David House wrote:

> On 11/11/06, Aditya Siram <aditya_siram at hotmail.com> wrote:
> > subOne :: [Integer] -> [Integer]
> > subOne = map (- 1)
> 
> The short answer is that this is interpreted as negative unity, rather
> than a section of binary minus. There are two common workarounds:
> 
> subOne = map (subtract 1)
> subOne = map (+ (-1))
> 
> There's a whole minefield of opinions on whether this is the right
> syntax or not. I'm sure you could google through the archives to
> research this a bit more.

E.g. this thread
  http://www.haskell.org/pipermail/haskell-cafe/2006-August/017403.html
continued here:
  http://www.haskell.org/pipermail/haskell-cafe/2006-September/017941.html


More information about the Haskell-Cafe mailing list