[Haskell-cafe] Signature of a function

Dmitri Pissarenko mailing-lists at dapissarenko.com
Tue Jan 11 09:49:48 EST 2005


I have a function activityIndicator, which has an argument of class Customer
and should return a numeric value.

The module is defined as follows.

data Purchase = Purchase { price, rebate :: Double }
        deriving (Show, Eq)

data Customer = Customer { id :: Int, purchases :: [Purchase] }

activityIndicator :: Customer -> Num
activityIndicator (Customer id purchases) = length purchases

When I try to load this module into GHCi, I get this error:

    Class `Num' used as a type
    In the type: Customer -> Num
    While checking the type signature for `activityIndicator'

When I remove the line

activityIndicator :: Customer -> Num

the error disappears.

What is wrong in the signature above?


Dmitri Pissarenko

More information about the Haskell-Cafe mailing list