[Haskell-cafe] Section Syntax Errors

David House dmhouse at gmail.com
Sat Nov 11 14:57:32 EST 2006


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.

-- 
-David House, dmhouse at gmail.com


More information about the Haskell-Cafe mailing list