[Haskell-cafe] Can't explain this error

Jon Fairbairn Jon.Fairbairn at cl.cam.ac.uk
Tue Jul 12 09:08:00 EDT 2005


On 2005-07-12 at 12:39-0000 "Dinh Tien Tuan Anh" wrote:
> 
> i have just encountered another type error.
> This program tries to print out partitions of a positive integer (i guess)
> 
> parts 0 = [[]]
> parts x = [concat (map (y:) parts(x-y) | y<-[1..(x `div` 2)]]

                                   ^

suspicious spacing! That's the same as

> parts x = [concat (map (y:) 
                         parts
                         (x-y)
            | y<-[1..(x `div` 2)]]

ie you are giving map three arguments when it expects two,
which is what the type error says.

-- 
Jón Fairbairn                              Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list